枚举 MailboxType 中是否缺少 GroupMailBox?

Is GroupMailBox missing from enum MailboxType?

我们的 EWS 邮件用户偶尔会遇到问题。在堆栈跟踪中我们看到

   System.ArgumentException: Requested value 'GroupMailbox' was not found.'

调查结果

这是 StackTrace:

at System.Enum.TryParseEnum (System.Type enumType, System.String value, Boolean ignoreCase, System.EnumResult& parseResult) <0x10087d640 + 0x0052b>
   in <filename unknown>:0 
  at System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase) <0x1006b91a8 + 0x00057>
   in <filename unknown>:0 
  at Microsoft.Exchange.WebServices.Data.EwsUtilities.Parse[T] (System.String value) <0x10114e1ac + 0x000e3>
   in <filename unknown>:0 
  at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadValue[T] () <0x10114e764 + 0x00053>
   in <filename unknown>:0
  at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadElementValue[T] () <0x10114e078 + 0x00087>
   in <filename unknown>:0 
  at Microsoft.Exchange.WebServices.Data.EmailAddress.TryReadElementFromXml (Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader reader) <0x1010a4330 + 0x00187>
  at Microsoft.Exchange.WebServices.Data.EmailAddress.TryReadElementFromXml (Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader reader) <0x1010a4330 + 0x00187>

在源代码中我们认为这个方法 电子邮件地址 :: TryReadElementFromXml

       case XmlElementNames.MailboxType:
                this.mailboxType = reader.ReadElementValue<MailboxType>();

分析:

我们认为对于某些邮件,正在尝试解析 MailboxType 枚举。但是,枚举 MailboxType 不包含值 GroupMailbox,因此会引发异常。

这是 MailboxType 枚举的文档

https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.mailboxtype%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396

是否有可能在枚举上更新了服务器逻辑没有保持最新???

此外:

此外,我们已经将其追溯到 EWSUtilities.cs

中的方法
    internal static T Parse<T>(string value)

else 子句是

            else
            {
                return (T)Enum.Parse(typeof(T), value, false);
            }

找不到枚举时应该保留给哪个???而不是执行 TryParse,而是执行失败的 Parse。

这好像也是个bug???

EWS Managed API 的来源在 GitHub 上,我相信这已经用新的 Enum https://github.com/OfficeDev/ews-managed-api/blob/154dbc66ac018d861c73ce489839cd9f58a1b0cd/Enumerations/MailboxType.cs 更新了。您应该编译并使用来自 GitHub 的最新源代码作为最新发布版本,而发布的 NuGet 版本早于更改。 (Microsoft 确实应该更新 NuGet 包以避免出现问题)。