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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.