BUG: 'ErrorNoPublicFolderServerAvailable' is not a valid value for ResponseCodeType

Another fine day and some great timings. I was discussing this bug with product group hoping that it is not faced by anyone outside Microsoft and then the phone rings.... I am getting the following error while trying to do a FindFolder call on to Public Folders

 Exception Type - System.InvalidOperationException 
Exception Message - Instance validation error: 'ErrorNoPublicFolderServerAvailable' is not a valid value for ResponseCodeType.

He had Exchange 2003 and Exchange 2007 running in Mixed mode in production environment where he was facing this error, though back on his test machine he could not reproduce his error message as the environment had only Exchange 2007.

He found a resolution himself by just shutting down the exchange 2003 machine for instance and it no longer throw the error message. So I came back to product group, asking for reasons. And it happened to be a bug in the product - Exchange 2007 SP1

They had migrated public folders from Exchange 2003 to Exchange 2007 Sp1, which actually caused the bug in message.xsd to trigger.

The error is possibly caused as there isn't a replica of the public folder content you're attempting to access on an Exchange2007 server.  So it's a configuration problem somewhere in your topology.

Product group may or may not hot-fix this issue in the next service pack release, they have already fixed this issue in next release of Exchange Server. I've got a workaround for you that I'd like you to try, if you can.  It should get you around this problem.  It has a big caveat, though, so please read through whole before you do anything.

The best way to work around this is:

  1. Copy the services.wsdl, messages.xsd, and types.xsd files down from your CAS server onto your local machine where you're running the Visual Studio proxy generator.

  2. Edit the file "messages.xsd."

    1. a. Add the enumeration value ErrorNoPublicFolderServerAvailable to the ResponseCodeType enumeration in that file.  This means you'll add a line that looks like
    2. <xs:enumeration value="ErrorNoPublicFolderServerAvailable" />
  3. Generate proxy classes using the WSDL/XSD files on your local machine (instead of from the Exchange server)

If this solution can't work for you for some reason, please let me know.

Now, the caveat:

If you ever want to regenerate your proxy classes for any reason in the future (like a server upgrade, or for some other reason), you might have to make this same modification again.  Note that I said "might."  The reason for that is because if we deal with this issue server-side, that new response code may already exist in the new messages.xsd, or the returned response code from the server may change to ErrorNoPublicFolderReplicaAvailable instead of ErrorNoPublicFolderServerAvailable.