Errors and the Proxy Classes

Now that you know what a response message is and how error information is embedded in it, how do you deal with response message errors when you are using the proxy classes? First, the response class and response code are exposed as properties on ResponseMessageType, so accessing those is quite easy. You can check the ResponseClass property if you like.

if (myResponseMessage.ResponseClass != ResponseClassType.Success)
{
  // Either an error or a warning...
  //
}

Or you can check the ResponseCode property.

if (myResponseMessage.ResponseCode != ResponseCodeType.NoError)
{
  // Either an error or a warning...
  //
}

You could also check ResponseClass for a value of Warning. However, the only warning Exchange Web Services exposes ...

Get Inside Microsoft® Exchange Server 2007 Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.