问题
An application uses EWS Managed API to fetch and process large quantities of Exchange items. The items are loaded using ExchangeService.LoadPropertiesForItems(items, propertySet)
.
During the items' processing, when a property of an item is being accessed, the following exception is thrown:
Microsoft.Exchange.WebServices.Data.ServiceResponseException: Data is corrupt., The object data is corrupted. The value of property [0x1039001f] PR_INTERNET_REFERENCES is too large and requires streaming.
The only thing I could find so far is an advice to use BindToItems()
instead of LoadPropertiesForItems()
, but I didn't try it out yet (I cannot reproduce the issue consistently).
My question, then, is: How do I do the streaming mentioned in the error (if that is what I need to do at all)?
Update (added some code examples)
var basicPropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.LastModifiedTime, ItemSchema.ParentFolderId)
{
new ExtendedPropertyDefinition(0x300B, MapiPropertyType.Binary)
};
var detailsPropset = new PropertySet(ItemSchema.Id, ItemSchema.LastModifiedTime, ItemSchema.DateTimeReceived,
ItemSchema.ParentFolderId, EmailMessageSchema.IsRead, ItemSchema.Subject, EmailMessageSchema.From)
{
new ExtendedPropertyDefinition(0x300B, MapiPropertyType.Binary), ItemSchema.MimeContent
};
var filter = new SearchFilter.SearchFilterCollection
{
new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.LastModifiedTime, modifiedSince),
new SearchFilter.IsLessThanOrEqualTo(ItemSchema.LastModifiedTime, modifiedBefore),
new SearchFilter.IsEqualTo(ItemSchema.ItemClass, itemClass),
};
var view = new ItemView(pageSize, 0, OffsetBasePoint.Beginning)
{
PropertySet = basicPropertySet
};
view.OrderBy.Add(ItemSchema.LastModifiedTime, SortDirection.Ascending);
// view.Offset is getting updated during the process
var items = exchangeService.FindItems(folderToScan.Id, searchFilter, view);
var ids = items.Select(item => item.Id).ToList();
exchangeService.LoadPropertiesForItems(items, detailedPropertySet);
foreach (var item in items)
{
// verify properties are loaded, by simply accessing them
// this is where the exception is thrown.
itemx.From;
item.LastModifiedTime;
item.Id;
item.MimeContent;
item.Subject;
}
来源:https://stackoverflow.com/questions/49543239/whats-the-cause-for-pr-internet-references-is-too-large-and-requires-streaming