2015-02-26 40 views
0

同時加載Itemproperty集EWS請幫Exchange Web服務錯誤:發生意外的文件結尾。以下元素未封閉:T:MimeContent

EmailMessage foundEmail = (EmailMessage)item; 
    PropertySet itemPorpertySet = new PropertySet(BasePropertySet.FirstClassProperties, 
         EmailMessageSchema.MimeContent,EmailMessageSchema.UniqueBody); 
    itemPorpertySet.RequestedBodyType = BodyType.HTML; 
     foundEmail.Load(itemPorpertySet); 


Error: 
    at System.Xml.XmlTextReaderImpl.Throw(Exception e) 
      at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) 
      at System.Xml.XmlTextReaderImpl.ThrowUnclosedElements() 
      at System.Xml.XmlTextReaderImpl.ParseElementContent() 
      at System.Xml.XmlTextReaderImpl.Read() 
      at System.Xml.XmlTextReader.Read() 
      at System.Xml.XmlCharCheckingReader.Read() 
      at System.Xml.XmlReader.ReadString() 
      at Microsoft.Exchange.WebServices.Data.MimeContent.ReadTextValueFromXml(EwsServiceXmlReader reader) 
      at Microsoft.Exchange.WebServices.Data.ComplexProperty.InternalLoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName, Func`2 readAction) 
      at Microsoft.Exchange.WebServices.Data.ComplexProperty.LoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName) 
      at Microsoft.Exchange.WebServices.Data.ComplexProperty.LoadFromXml(EwsServiceXmlReader reader, String xmlElementName) 
      at Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinitionBase.InternalLoadFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) 
      at Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinitionBase.LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) 
      at Microsoft.Exchange.WebServices.Data.PropertyBag.LoadFromXml(EwsServiceXmlReader reader, Boolean clear, PropertySet requestedPropertySet, Boolean onlySummaryPropertiesRequested) 
      at Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader.ReadServiceObjectsCollectionFromXml[TServiceObject](XmlNamespace collectionXmlNamespace, String collectionXmlElementName, GetObjectInstanceDelegate`1 getObjectInstanceDelegate, Boolean clearPropertyBag, PropertySet requestedPropertySet, Boolean summaryPropertiesOnly) 
      at Microsoft.Exchange.WebServices.Data.GetItemResponse.ReadElementsFromXml(EwsServiceXmlReader reader) 
      at Microsoft.Exchange.WebServices.Data.ServiceResponse.LoadFromXml(EwsServiceXmlReader reader, String xmlElementName) 
      at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.ParseResponse(EwsServiceXmlReader reader) 
      at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadResponse(EwsServiceXmlReader ewsXmlReader) 
      at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponseXml(Stream responseStream) 
      at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response) 
      at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute() 
      at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalLoadPropertiesForItems(IEnumerable`1 items, PropertySet propertySet, ServiceErrorHandling errorHandling) 
      at Microsoft.Exchange.WebServices.Data.Item.InternalLoad(PropertySet propertySet) 
      at Microsoft.Exchange.WebServices.Data.ServiceObject.Load(PropertySet propertySet) 

回答

0

託管API對象未能解析響應我有以下錯誤。所以要麼是響應不好,要麼是舊版本的API。您可能會嘗試獲取最新版本的API(從GitHubNuGet)。或者你可以enable tracing並檢查服務器的響應,看看是否有問題。

相關問題