Search code examples
c#exchangewebservicesexchange-server-2010

appointment.Sensitivity EWS C#


Hi I am trying to display all non sensitive appointments in EWS (I can get all appointments fine, but even with restricted permissions I can still see private appointments which I shouldn't be able to see!)

This is basically what I want to do:

       if ( appointment.Sensitivity  == "Normal")

    Console.WriteLine(appointment.Subject);
}

However I get operator '==' cannot be applied to operands of type 'Microsoft.Exchange.WebServices.Data.Sensitivity' and 'String'

Can someone please advise?


Solution

  • Compare it to the enum Microsoft.Exchange.WebServices.Data.Sensitivity rather than using ToString()

    string message = appointment.Subject + " - " + appointment.Sensitivity;
    
    if (appointment.Sensitivity == Sensitivity.Normal)
        Console.WriteLine(message);