private UniqueItemHash GetUniqueItemHash(string hash) { UniqueItemHash result; try { result = UniqueItemHash.Parse(hash); } catch (ArgumentException innerException) { throw new WebServiceProxyInvalidResponseException(Strings.InvalidItemHashInPreviewResult(this.Uri.AbsoluteUri), innerException); } return(result); }
private ExtendedPropertyType[] CreateItemExtendedPropertyValuesFromItemId(ItemId itemId) { List <ExtendedPropertyType> list = new List <ExtendedPropertyType>(10); if (!string.IsNullOrEmpty(itemId.Id)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ItemIdExtendedProperty, Item = itemId.Id }); } if (!string.IsNullOrEmpty(itemId.ParentFolder)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ParentFolderIdExtendedProperty, Item = itemId.ParentFolder }); } if (!string.IsNullOrEmpty(itemId.PrimaryItemId)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.PrimaryItemIdExtendedProperty, Item = itemId.PrimaryItemId }); } if (itemId.Size != 0U) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ItemSizeExtendedProperty, Item = itemId.Size.ToString() }); } if (!string.IsNullOrEmpty(itemId.Subject)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.SubjectExtendedProperty, Item = MailboxItemIdList.EncodeDataForEws(itemId.Subject) }); } if (itemId.DocumentId != 0) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.DocumentIdExtendedProperty, Item = itemId.DocumentId.ToString() }); } if (!string.IsNullOrEmpty(itemId.Sender)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.SenderExtendedProperty, Item = MailboxItemIdList.EncodeDataForEws(itemId.Sender) }); } if (!string.IsNullOrEmpty(itemId.SenderSmtpAddress)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.SenderSmtpAddressExtendedProperty, Item = MailboxItemIdList.EncodeDataForEws(itemId.SenderSmtpAddress) }); } if (itemId.ReceivedTime != DateTime.MinValue) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ReceivedTimeExtendedProperty, Item = itemId.ReceivedTime.ToString() }); } if (itemId.SentTime != DateTime.MinValue) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.SentTimeExtendedProperty, Item = itemId.SentTime.ToString() }); } if (!string.IsNullOrEmpty(itemId.Importance)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ImportanceExtendedProperty, Item = itemId.Importance }); } list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.IsReadExtendedProperty, Item = itemId.IsRead.ToString() }); if (!string.IsNullOrEmpty(itemId.UniqueHash)) { UniqueItemHash uniqueItemHash = UniqueItemHash.Parse(itemId.UniqueHash); if (!string.IsNullOrEmpty(uniqueItemHash.InternetMessageId)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.InternetMessageIdExtendedProperty, Item = uniqueItemHash.InternetMessageId }); } if (!string.IsNullOrEmpty(uniqueItemHash.ConversationTopic)) { list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.ConversationTopicExtendedProperty, Item = MailboxItemIdList.EncodeDataForEws(uniqueItemHash.ConversationTopic) }); } list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.IsSentItemsExtendedProperty, Item = uniqueItemHash.IsSentItems.ToString() }); if (uniqueItemHash.BodyTagInfo != null) { byte[] inArray = uniqueItemHash.BodyTagInfo.ToByteArray(); string item = Convert.ToBase64String(inArray); list.Add(new ExtendedPropertyType { ExtendedFieldURI = MailboxItemIdList.BodyTagInfoExtendedProperty, Item = item }); } } return(list.ToArray()); }