/// <summary> /// In the specified directory <paramref name="folder"/>, finds all items <see cref="Exchange.Item"/>, /// that match the filter <paramref name="filter"/>, and returns them collection. In the object /// <paramref name="view"/> fixed number of read items in the catalog. /// </summary> /// <param name="folder">Exchange folder.</param> /// <param name="filter">Search filter.</param> /// <param name="view">Settings view in the directory search operation.</param> /// <returns>Items collection<see cref="Exchange.Item"/>. /// </returns> public static Exchange.FindItemsResults <Exchange.Item> ReadItems(this Exchange.Folder folder, Exchange.SearchFilter filter, Exchange.ItemView view) { Exchange.FindItemsResults <Exchange.Item> result = filter == null?folder.FindItems(view) : folder.FindItems(filter, view); view.Offset = result.NextPageOffset ?? 0; return(result); }
/// <summary> /// Gets emails from <see cref="itemCollection"/> /// </summary> /// <param name="itemCollection">Finding list items from exchange.</param> /// <param name="activityFolderIds">List folders uniqueidentifier.</param> /// <returns></returns> public virtual IEnumerable <IRemoteItem> GetEmailsFromCollection(Exchange.FindItemsResults <Exchange.Item> itemCollection, List <Guid> activityFolderIds) { SyncItemSchema schema = FindSchemaBySyncValueName(typeof(ExchangeEmailMessage).Name); foreach (Exchange.Item item in itemCollection) { if (item is Exchange.EmailMessage) { Exchange.PropertySet properties = new Exchange.PropertySet(Exchange.BasePropertySet.IdOnly); Exchange.EmailMessage bindEmail = ExchangeUtility.SafeBindItem <Exchange.EmailMessage>(Service, item.Id, properties); if (bindEmail != null) { var remoteItem = new ExchangeEmailMessage(schema, bindEmail, TimeZone) { ActivityFolderIds = activityFolderIds }; yield return(remoteItem); } } } }
/// <summary> /// Gets true if the elements of the collection are available for reading. /// </summary> /// <param name="itemCollection">List exchange items.</param> /// <returns>Flag indicates if the elements of the collection are available for reading. </returns> protected virtual bool GetMoreAvailable(Exchange.FindItemsResults <Exchange.Item> itemCollection) { return(itemCollection.MoreAvailable); }