Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <summary>
        /// <see cref="ExchangeSyncProvider.EnumerateChanges"/>
        /// </summary>
        public override IEnumerable <IRemoteItem> EnumerateChanges(SyncContext context)
        {
            base.EnumerateChanges(context);
            var result = new List <IRemoteItem>();

            if (!UserSettings.ImportActivities)
            {
                return(result);
            }
            var folders = new List <Exchange.Folder>();

            Exchange.FolderId trashFolderId = Exchange.Folder.Bind(
                Service, Exchange.WellKnownFolderName.DeletedItems, Exchange.BasePropertySet.IdOnly).Id;
            if (UserSettings.ImportActivitiesAll)
            {
                Exchange.Folder rootFolder = Exchange.Folder.Bind(Service, Exchange.WellKnownFolderName.MsgFolderRoot);
                folders.GetAllFoldersByFilter(rootFolder);
                folders.Add(rootFolder);
            }
            else
            {
                folders = SafeBindFolders(Service, UserSettings.RemoteFolderUIds.Keys, context);
            }
            Exchange.SearchFilter itemsFilter = GetItemsSearchFilters();
            SyncItemSchema        schema      = FindSchemaBySyncValueName(typeof(ExchangeTask).Name);

            foreach (Exchange.Folder folder in folders)
            {
                if (folder.Id.Equals(trashFolderId))
                {
                    continue;
                }
                var itemView = new Exchange.ItemView(PageItemCount);
                Exchange.FindItemsResults <Exchange.Item> itemCollection;
                do
                {
                    itemCollection = folder.ReadItems(itemsFilter, itemView);
                    foreach (Exchange.Item item in itemCollection)
                    {
                        Exchange.Task task = ExchangeUtility.SafeBindItem <Exchange.Task>(Service, item.Id);
                        if (task != null)
                        {
                            var remoteItem = new ExchangeTask(schema, task, TimeZone);
                            result.Add(remoteItem);
                        }
                    }
                } while (itemCollection.MoreAvailable);
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets filters for Exchange data query.
        /// </summary>
        /// <returns>Filter instance.</returns>
        private Exchange.SearchFilter GetItemsSearchFilters(SyncContext context = null)
        {
            Exchange.SearchFilter filter      = null;
            DateTime lastSyncDateUtc          = TimeZoneInfo.ConvertTimeToUtc(UserSettings.LastSyncDate, TimeZone);
            DateTime importActivitiesFromDate = UserSettings.ImportActivitiesFrom;

            context?.LogInfo(SyncAction.None, SyncDirection.Download, "lastSyncDateUtc = {0}, importActivitiesFromDate = {1}",
                             lastSyncDateUtc, importActivitiesFromDate);
            if (lastSyncDateUtc != DateTime.MinValue && UserSettings.ImportActivitiesFrom != DateTime.MinValue)
            {
                var lastSyncDateUtcFilter = new Exchange.SearchFilter.IsGreaterThan(
                    Exchange.ItemSchema.LastModifiedTime, lastSyncDateUtc.ToLocalTime());
                var filterCollection       = new Exchange.SearchFilter.SearchFilterCollection(Exchange.LogicalOperator.Or);
                var customPropSetFilter    = new Exchange.SearchFilter.Exists(ExchangeUtilityImpl.LocalIdProperty);
                var notCustomPropSetFilter = new Exchange.SearchFilter.Not(customPropSetFilter);
                filterCollection.AddRange(new List <Exchange.SearchFilter> {
                    lastSyncDateUtcFilter,
                    notCustomPropSetFilter
                });
                if (context != null && GetExchangeRecurringAppointmentsSupported(context.UserConnection))
                {
                    return(filterCollection);
                }
                var allFilterCollection            = new Exchange.SearchFilter.SearchFilterCollection(Exchange.LogicalOperator.And);
                var importActivitiesFromDateFilter = new Exchange.SearchFilter.IsGreaterThanOrEqualTo(
                    Exchange.AppointmentSchema.Start, importActivitiesFromDate);
                allFilterCollection.AddRange(new List <Exchange.SearchFilter> {
                    importActivitiesFromDateFilter,
                    filterCollection
                });
                filter = allFilterCollection;
            }
            else if (lastSyncDateUtc != DateTime.MinValue && UserSettings.ImportActivitiesFrom == DateTime.MinValue)
            {
                filter = new Exchange.SearchFilter.IsGreaterThan(
                    Exchange.ItemSchema.LastModifiedTime, lastSyncDateUtc.ToLocalTime());
            }
            else if (lastSyncDateUtc == DateTime.MinValue && UserSettings.ImportActivitiesFrom != DateTime.MinValue)
            {
                filter = new Exchange.SearchFilter.IsGreaterThanOrEqualTo(
                    Exchange.AppointmentSchema.Start, importActivitiesFromDate);
            }
            return(filter);
        }
Esempio n. 4
0
        /// <summary>
        /// Returns all items by <paramref name="filter"/> from <paramref name="folder"/>. Recurring apointments not included.
        /// </summary>
        /// <param name="folder"><see cref=" Exchange.Folder"/> instance.</param>
        /// <param name="filter"><see cref=" Exchange.SearchFilter"/> instance.</param>
        /// <returns><see cref="Exchange.Item"/> collection.</returns>
        protected IEnumerable <Exchange.Item> GetCalendarItems(Exchange.Folder folder, Exchange.SearchFilter filter)
        {
            var itemView = new Exchange.ItemView(PageItemCount);

            Exchange.FindItemsResults <Exchange.Item> itemCollection;
            do
            {
                itemCollection = folder.ReadItems(filter, itemView);
                foreach (var item in itemCollection)
                {
                    yield return(item);
                }
            } while (itemCollection.MoreAvailable);
        }
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     this.searchFilter = SearchFilter.LoadFromXml(reader);
     return true;
 }
        private List<Item> GetItems(ExchangeService service, SearchFilter filter, WellKnownFolderName folder, PropertySet propertySet)
        {
            if (service == null)
            {
                return null;
            }

            List<Item> items = new List<Item>();

            if (propertySet == null)
            {
                propertySet = new PropertySet(BasePropertySet.IdOnly);
            }

            const Int32 pageSize = 50;
            ItemView itemView = new ItemView(pageSize);
            itemView.PropertySet = propertySet;

            FindItemsResults<Item> searchResults = null;
            try
            {
                do
                {
                    searchResults = service.FindItems(folder,
                        filter, itemView);
                    items.AddRange(searchResults.Items);

                    itemView.Offset += pageSize;
                } while (searchResults.MoreAvailable);
            }
            catch (Exception ex)
            {
                NotifyDownloadStatus(DownloadStatus.INFORM, ex.Message);
                return null;
            }
            return items;
        }
        private List<Item> GetItems(ExchangeService service, SearchFilter filter, WellKnownFolderName folder, PropertySet propertySet)
        {
            if (service == null)
            {
                return null;
            }

            List<Item> items = new List<Item>();

            if (propertySet == null)
            {
                propertySet = new PropertySet(BasePropertySet.IdOnly);
            }

            const Int32 pageSize = 50;
            ItemView itemView = new ItemView(pageSize);
            itemView.PropertySet = propertySet;

            FindItemsResults<Item> searchResults = null;
            try
            {
                do
                {
                    searchResults = service.FindItems(folder,
                        filter, itemView);
                    items.AddRange(searchResults.Items);

                    itemView.Offset += pageSize;
                } while (searchResults.MoreAvailable);
            }
            catch (Exception ex)
            {
                if (!CheckServerConnection(domain))
                {
                    NotifyDownloadStatus(DownloadStatus.INFORM, "Unable to connect to Exchange server. Please check.");
                }
                else
                {
                    NotifyDownloadStatus(DownloadStatus.INFORM, "The username or password is incorrect. Please try again.");
                }
                return null;
            }
            return items;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Not"/> class.
 /// </summary>
 /// <param name="searchFilter">The search filter to negate. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollection.</param>
 public Not(SearchFilter searchFilter)
     : base()
 {
     this.searchFilter = searchFilter;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SeekToConditionItemView"/> class.
 /// </summary>
 /// <param name="condition">Condition to be used when seeking.</param>
 /// <param name="pageSize">The maximum number of elements the search operation should return.</param>
 /// <param name="offsetBasePoint">The base point of the offset.</param>
 public SeekToConditionItemView(
     SearchFilter condition,
     int pageSize,
     OffsetBasePoint offsetBasePoint)
     : this(condition, pageSize)
 {
     this.OffsetBasePoint = offsetBasePoint;
 }
        private List<Item> GetItems(ExchangeService service, SearchFilter filter, WellKnownFolderName folder, PropertySet propertySet)
        {
            if (service == null)
            {
                return null;
            }

            List<Item> items = new List<Item>();

            if (propertySet == null)
            {
                propertySet = new PropertySet(BasePropertySet.IdOnly);
            }

            const Int32 pageSize = 50;
            ItemView itemView = new ItemView(pageSize);
            itemView.PropertySet = propertySet;

            FindItemsResults<Item> searchResults = null;
            try
            {
                do
                {
                    searchResults = service.FindItems(folder,
                        filter, itemView);
                    items.AddRange(searchResults.Items);

                    itemView.Offset += pageSize;
                } while (searchResults.MoreAvailable);
            }
            catch (Exception ex)
            {
                if (!CheckServerConnection(domain))
                {
                    NotifyDownloadStatus(DownloadStatus.INFORM, CMController.Properties.Resources.unconnect_exchange_server);
                    return null;
                }
                else
                {
                    NotifyDownloadStatus(DownloadStatus.INFORM, CMController.Properties.Resources.wrong_username_password);
                    return null;
                }
            }
            return items;
        }
Esempio n. 11
0
 internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
 {
     this.searchFilter = SearchFilter.LoadSearchFilterFromJson(jsonProperty.ReadAsJsonObject(XmlElementNames.Item), service);
 }
Esempio n. 12
0
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     this.searchFilter = SearchFilter.LoadFromXml(reader);
     return(true);
 }
Esempio n. 13
0
 /// <summary>
 /// In the specified directory <paramref name="folder"/> searches for all subdirectories
 /// that match the specified filter <paramref name="filter"/> and returns them to the collection <paramref name="list"/>.
 /// </summary>
 /// <param name="list">Filtered Exchange Server catalog collection.</param>
 /// <param name="folder">The directory from which the recursive search is performed.</param>
 /// <param name="filter">Search filter.</param>
 public static void GetAllFoldersByFilter(this List <Exchange.Folder> list, Exchange.Folder folder, Exchange.SearchFilter filter = null)
 {
     if (folder.ChildFolderCount > 0 && list != null)
     {
         Exchange.FindFoldersResults searchedFolders;
         var folderView = new Exchange.FolderView(folder.ChildFolderCount);
         if (filter != null)
         {
             searchedFolders = folder.FindFolders(filter, folderView);
         }
         else
         {
             searchedFolders = folder.FindFolders(folderView);
         }
         list.AddRange(searchedFolders);
         foreach (Exchange.Folder findFoldersResult in searchedFolders)
         {
             list.GetAllFoldersByFilter(findFoldersResult, filter);
         }
     }
 }
Esempio n. 14
0
        /// <summary>
        /// <see cref="ExchangeSyncProvider.EnumerateChanges"/>
        /// </summary>
        public override IEnumerable <IRemoteItem> EnumerateChanges(SyncContext context)
        {
            base.EnumerateChanges(context);
            FillFoldersList(context);
            var result = new List <IRemoteItem>();

            if (!UserSettings.ImportActivities)
            {
                return(result);
            }
            Exchange.SearchFilter itemsFilter = GetItemsSearchFilters(context);
            SyncItemSchema        schema      = FindSchemaBySyncValueName(typeof(ExchangeAppointment).Name);
            var needGetRecurringAppointments  = NeedGetRecurringAppointments(context);

            Exchange.PropertySet properties = new Exchange.PropertySet(Exchange.BasePropertySet.IdOnly);
            properties.AddRange(new[] {
                Exchange.ItemSchema.Subject,
                Exchange.ItemSchema.LastModifiedTime,
                Exchange.AppointmentSchema.Recurrence,
                Exchange.AppointmentSchema.IsRecurring,
                Exchange.AppointmentSchema.AppointmentType,
                Exchange.AppointmentSchema.ICalUid,
                Exchange.AppointmentSchema.ICalRecurrenceId,
                Exchange.AppointmentSchema.Start
            });
            foreach (Exchange.Folder folder in Folders)
            {
                bool hasRecurence = false;
                if (!needGetRecurringAppointments)
                {
                    foreach (Exchange.Item item in GetCalendarItems(folder, itemsFilter))
                    {
                        Exchange.Appointment appointment = ExchangeUtility.SafeBindItem <Exchange.Appointment>(Service, item.Id, properties);
                        if (appointment != null)
                        {
                            var recurentAppointment = GetExchangeRecurringAppointmentsSupported(context.UserConnection) && appointment.Recurrence != null;
                            var isRecurringMaster   = appointment.AppointmentType == Exchange.AppointmentType.RecurringMaster;
                            if ((!recurentAppointment || isRecurringMaster) && CheckItemInSyncPeriod(context, appointment))
                            {
                                context?.LogInfo(SyncAction.None, SyncDirection.Download, "Adding single or master appoitment {0}", appointment.Subject);
                                var remoteItem = CreateExchangeAppointment(schema, appointment, TimeZone);
                                context?.LogInfo(SyncAction.None, SyncDirection.Download, "Created ExchangeAppointment with Id {0}", remoteItem.Id);
                                if (isRecurringMaster)
                                {
                                    context?.LogInfo(SyncAction.None, SyncDirection.Download, "Adding master appoitment {0}", appointment.Subject);
                                    remoteItem.Action = SyncAction.CreateRecurringMaster;
                                }
                                result.Add(remoteItem);
                            }
                            hasRecurence = hasRecurence || recurentAppointment;
                        }
                    }
                }
                if (hasRecurence || needGetRecurringAppointments)
                {
                    foreach (Exchange.Item item in GetAppointmentsForPeriod(context, folder))
                    {
                        context?.LogInfo(SyncAction.None, SyncDirection.Download, "Input item - Subject {0}, UniqueId - {1}", item.Subject, item.Id.UniqueId);
                        Exchange.Appointment appointment = ExchangeUtility.SafeBindItem <Exchange.Appointment>(Service, item.Id, properties);
                        context?.LogInfo(SyncAction.None, SyncDirection.Download, "Adding recurence appoitment {0}", appointment.Subject);
                        if (appointment != null)
                        {
                            var remoteItem = CreateExchangeAppointment(schema, appointment, TimeZone);
                            context?.LogInfo(SyncAction.None, SyncDirection.Download, "Created recurence ExchangeAppointment with Id {0}", remoteItem.Id);
                            result.Add(remoteItem);
                        }
                    }
                }
            }
            context?.LogInfo(SyncAction.None, SyncDirection.Download, "loaded {0} items from Exchange", result.Count);
            return(result);
        }
        private List<MailItem> SearchSubFolders(ExchangeService service,
            WellKnownFolderName parentFolder,
            MailSearchContainerNameList subFolderNames,
            string mailBoxName,
            SearchFilter.SearchFilterCollection searchFilters)
        {
            var result = new List<MailItem>();
            try
            {
                var subFolders = FindSubFolders(service,
                                                parentFolder,
                                                subFolderNames);
                if (subFolders == null || subFolders.Count() <= 0) return result;
                var itemView = new ItemView(VIEW_SIZE);
                itemView.PropertySet = new PropertySet {ItemSchema.Id,
                                                        ItemSchema.HasAttachments,
                                                        ItemSchema.Subject,
                                                        ItemSchema.Body};
                foreach (var subFolder in subFolders)
                {
                    var matches = service.FindItems(subFolder.Id, searchFilters, itemView);
                    AddItems(service, matches, result,mailBoxName,subFolder.DisplayName);
                }

            }
            catch (Exception ex)
            {
                //Ignore
                Debug.WriteLine(string.Format("Error encountered searching subfolders: {0}\n {1}", ex.ToString(), ex.StackTrace.ToString()));
            }
            return result;
        }
        private List<MailItem> SearchSharedMailBoxes(ExchangeService service,                    
            ItemView view,
            SearchFilter.SearchFilterCollection searchFilters,
            MailSearchContainerNameList mailBoxNames,
            string mailDomain,
            string searchTerm)
        {
            var result = new List<MailItem>();
            if (mailBoxNames == null
                || mailBoxNames.Count <= 0 ) return result;

            foreach (var mailBoxName in mailBoxNames)
            {
                try
                {
                    var fullyQualifiedMailboxName = String.Format("{0}@{1}", mailBoxName, mailDomain);
                    Mailbox mb = new Mailbox(fullyQualifiedMailboxName);
                    FolderId fid1 = new FolderId(WellKnownFolderName.Inbox, mb);
                    var rootFolder = Folder.Bind(service, fid1);
                    var items = rootFolder.FindItems(view);
                    service.LoadPropertiesForItems(items, new PropertySet { ItemSchema.Attachments, ItemSchema.HasAttachments });
                    var matches = service.FindItems(fid1, searchFilters, view);
                    AddItems(service, matches, result, fullyQualifiedMailboxName, "InBox");
                }
                catch (ServiceResponseException)
                {
                    //Ignore this indicates the user has no access to the mail box.
                    Debug.WriteLine(String.Format("Trouble accessing mailbox {0} assuming no access.", mailBoxName));
                }
            }
            return result;
        }
        private List<MailItem> SearchMailFolders(ExchangeService service,
            ItemView view,
            SearchFilter.SearchFilterCollection searchFilters,
            MailSearchContainerNameList mailFolderNames,
            string searchTerm)
        {
            var result = new List<MailItem>();
            if (mailFolderNames == null
                || mailFolderNames.Count <= 0) return result;

            var personalFolderMatches = SearchSubFolders(service,
                                                         WellKnownFolderName.MsgFolderRoot,
                                                         mailFolderNames,
                                                         "personal mailbox",
                                                         searchFilters);
            var publicFolderMatches = SearchSubFolders(service,
                                                         WellKnownFolderName.MsgFolderRoot,
                                                         mailFolderNames,
                                                         "public folders",
                                                         searchFilters);

            if (personalFolderMatches != null) result.AddRange(personalFolderMatches);
            if (publicFolderMatches != null) result.AddRange(publicFolderMatches);

            return result;
        }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SeekToConditionItemView"/> class.
 /// </summary>
 /// <param name="condition">Condition to be used when seeking.</param>
 /// <param name="pageSize">The maximum number of elements the search operation should return.</param>
 public SeekToConditionItemView(SearchFilter condition, int pageSize)
 {
     this.Condition      = condition;
     this.PageSize       = pageSize;
     this.serviceObjType = ServiceObjectType.Item;
 }
Esempio n. 19
0
        /// <summary>
        /// Obtains a list of folders by searching the sub-folders of this folder. Calling this method results in a call to EWS.
        /// </summary>
        /// <param name="searchFilter">The search filter. Available search filter classes
        /// include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and
        /// SearchFilter.SearchFilterCollection</param>
        /// <param name="view">The view controlling the number of folders returned.</param>
        /// <returns>An object representing the results of the search operation.</returns>
        public FindFoldersResults FindFolders(SearchFilter searchFilter, FolderView view)
        {
            this.ThrowIfThisIsNew();

            return(this.Service.FindFolders(this.Id, searchFilter, view));
        }
Esempio n. 20
0
 /// <summary>
 /// In the specified directory <paramref name="folder"/> searches for all subdirectories
 /// that match the specified filter <paramref name="filter"/> with the corresponding class <paramref name="className"/>
 /// and returns them to the collection <paramref name="list"/>.
 /// </summary>
 /// <param name="list">Filtered Exchange Server catalog collection.</param>
 /// <param name="folder">The directory from which the recursive search is performed.</param>
 /// <param name="className">Class name for search.</param>
 /// <param name="filter">Search filter.</param>
 public static void GetAllFoldersByClass(this List <Exchange.Folder> list, Exchange.Folder folder, string className, Exchange.SearchFilter filter)
 {
     if (folder.ChildFolderCount > 0 && list != null)
     {
         Exchange.FindFoldersResults childFolders;
         var folderView = new Exchange.FolderView(folder.ChildFolderCount);
         if (filter == null)
         {
             childFolders = folder.FindFolders(folderView);
         }
         else
         {
             childFolders = folder.FindFolders(filter, folderView);
         }
         foreach (Exchange.Folder childFolder in childFolders)
         {
             if (childFolder.FolderClass == className)
             {
                 list.Add(childFolder);
             }
             list.GetAllFoldersByClass(childFolder, className, filter);
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SeekToConditionItemView"/> class.
 /// </summary>
 /// <param name="condition">Condition to be used when seeking.</param>
 /// <param name="pageSize">The maximum number of elements the search operation should return.</param>
 public SeekToConditionItemView(SearchFilter condition, int pageSize)
 {
     this.Condition = condition;
     this.PageSize = pageSize;
     this.serviceObjType = ServiceObjectType.Item;
 }
Esempio n. 22
0
        /// <summary>
        /// <see cref="ExchangeSyncProvider.EnumerateChanges"/>
        /// </summary>
        public override IEnumerable <IRemoteItem> EnumerateChanges(SyncContext context)
        {
            base.EnumerateChanges(context);
            var result = new List <IRemoteItem>();

            if (!UserSettings.ImportContacts)
            {
                return(result);
            }
            var folders = new List <Exchange.Folder>();

            if (UserSettings.ImportContactsAll)
            {
                Exchange.Folder rootFolder = Exchange.Folder.Bind(Service, Exchange.WellKnownFolderName.MsgFolderRoot);
                var             filter     = new Exchange.SearchFilter.IsEqualTo(
                    Exchange.FolderSchema.FolderClass, ExchangeConsts.ContactFolderClassName);
                folders.GetAllFoldersByFilter(rootFolder, filter);
            }
            else
            {
                folders = SafeBindFolders(Service, UserSettings.RemoteFolderUIds.Keys, context);
            }
            Exchange.SearchFilter itemsFilter = GetExternalItemsFiltersHandler != null
                                        ? GetExternalItemsFiltersHandler() as Exchange.SearchFilter
                                        : GetContactsFilters();

            SyncItemSchema schema = FindSchemaBySyncValueName(typeof(ExchangeContact).Name);
            var            exchangeAddrDetails = new List <ExchangeAddressDetail>();
            var            exchangeCompanies   = new List <string>();

            foreach (Exchange.Folder noteFolder in folders)
            {
                var itemView = new Exchange.ItemView(PageItemCount);
                Exchange.FindItemsResults <Exchange.Item> itemCollection;
                do
                {
                    itemCollection = noteFolder.ReadItems(itemsFilter, itemView);
                    foreach (Exchange.Item item in itemCollection)
                    {
                        Exchange.Contact fullContact = GetFullItemHandler != null
                                                                ? GetFullItemHandler(item.Id.UniqueId) as Exchange.Contact
                                                                : GetFullContact(item.Id);

                        if (fullContact == null)
                        {
                            continue;
                        }
                        var remoteItem = new ExchangeContact(schema, fullContact, TimeZone);
                        remoteItem.InitIdProperty(context);
                        result.Add(remoteItem);
                        if (!string.IsNullOrEmpty(fullContact.CompanyName))
                        {
                            exchangeCompanies.Add(fullContact.CompanyName);
                        }
                        AddAddressDetails(exchangeAddrDetails, fullContact);
                    }
                } while (itemCollection.MoreAvailable);
            }
            FillAddressDetailsData(context, exchangeAddrDetails);
            FillAccountsMap(context, exchangeCompanies.Distinct().ToList());
            return(result);
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Not"/> class.
 /// </summary>
 /// <param name="searchFilter">The search filter to negate. Available search filter classes include SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and SearchFilter.SearchFilterCollection.</param>
 public Not(SearchFilter searchFilter)
     : base()
 {
     this.searchFilter = searchFilter;
 }