Search code examples
exchangewebservices

Error accessing the NamedResolutionCollection


I'm using the Exchange API with C#. I am trying to access the NamedResolutionCollection and I am getting the following error: "This property was requested, but it wasn't returned by the server." Is this a permissions issue?


Solution

  • (this depends on the property but generally)If a particular property isn't set on the Item then EWS won't return it as null and that error is how the EWS Managed API has been written to surface it. In EWS Managed API you can use TryGetProperty to check if a property has been returned.

    Object SubjectValue = null;
    if (Email.TryGetProperty(ItemSchema.Subject, out SubjectValue))
    {
    
    }
    

    The Subject is a extreme case and not generally needed but I have seen that same error on that prop when scanning through every item in a Mailbox.