none
Items.Find on calendar items fails when there is a bracket in the search string RRS feed

  • Question

  • I have a routine that creates appointments for regular timetabled sessions. Before it creates a new appointment it checks to see whether there is already an appointment with that date and time and subject. This works well and the code can adjust the search string if there is an apostrophe (') in the string. However, it fails and raises an exception if there is a bracket in the string, eg. "Le Chandeleur (La Fete des Crepes)".

    How can I protect against this?


    Mike VE

    Wednesday, April 24, 2019 5:36 PM

All replies

  • I had no problem creating an appointment with that subject and having it returned by Items.Find when I used a query like

    [Subject] ='Le Chandeleur (La Fete des Crepes)'


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Saturday, April 27, 2019 3:57 PM
  • Hi Dmitry

    Thanks for answering. I must admit I was in too much of a hurry and did not try to replicate the error. The actual error message received from my client was 'System.Runtime.InteropServices.COMException Cannot parse condition. Error at "La"'. My addin's error logging showed that the Find command had triggered the error and that the search string was "[Subject] ='Le Chandeleur (La Fete des Crepes)'".

    I am used to clients occasionally reporting errors I cannot reproduce and if they are non-critical I tend to put it down to some difference in their general environment.

    Could I have made the wrong assumption that is was the bracket that triggered the exception?


    Mike VE

    Wednesday, May 1, 2019 8:50 AM
  • You can ask the customer for the problematic appointment that caused this error and try to reproduce it.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, May 1, 2019 5:50 PM