当前位置: 首页>>代码示例>>C#>>正文


C# Folder.FindItems方法代码示例

本文整理汇总了C#中Folder.FindItems方法的典型用法代码示例。如果您正苦于以下问题:C# Folder.FindItems方法的具体用法?C# Folder.FindItems怎么用?C# Folder.FindItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder.FindItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetItem

        internal List<Item> GetItem(Folder folder, ItemView iView, DateTime startDate, DateTime endDate, string subjectToSearch)
        {
            SearchFilter.SearchFilterCollection searchFilterCollection = new SearchFilter.SearchFilterCollection(LogicalOperator.And);
            searchFilterCollection.Add(new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.DateTimeReceived, startDate));
            searchFilterCollection.Add(new SearchFilter.IsLessThanOrEqualTo(ItemSchema.DateTimeReceived, endDate));

            if (!String.IsNullOrEmpty(subjectToSearch))
            {
                searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Subject, subjectToSearch));
            }

            SearchFilter searchFilter = searchFilterCollection;
            FindItemsResults<Item> findResult = folder.FindItems(searchFilter, iView);

            return this.GetListItem(findResult);
        }
开发者ID:IvanFranjic,项目名称:XEws,代码行数:16,代码来源:XEwsItemCmdlet.cs

示例2: MarkAllAsRead

 static void MarkAllAsRead(Folder folder)
 {
     if (folder.ChildFolderCount == 0)
     {
         ItemView itemView = new ItemView(100);
         itemView.PropertySet = new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.IsRead);
         SearchFilter filter = new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false);
         folder.FindItems(filter, itemView)
               .Cast<EmailMessage>()
               .ToList()
               .ForEach(item =>
         {
             item.IsRead = true;
             item.Update(ConflictResolutionMode.AutoResolve);
         });
     }
     else
     {
         FolderView folderView = new FolderView(folder.ChildFolderCount);
         folder.FindFolders(folderView).ToList().ForEach(child => MarkAllAsRead(child));
     }
 }
开发者ID:krispharper,项目名称:MarkExchangeItemsAsRead,代码行数:22,代码来源:Program.cs

示例3: GetItemIds

        private static List<ItemId> GetItemIds(Folder source, ExchangeService service, ItemTraversal traversal)
        {
            // Collect the Ids of all the items in the folder
            List<ItemId> itemIds = new List<ItemId>();

            FindItemsResults<Item> findResults = null;
            while (findResults == null || findResults.MoreAvailable == true)
            {
                DebugLog.WriteVerbose("Calling FindItems.");

                ItemView view = new ItemView(
                    GlobalSettings.DumpFolderViewSize,
                    itemIds.Count);

                view.Traversal = traversal;
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
                findResults = source.FindItems(view);

                DebugLog.WriteVerbose(String.Concat("FindItems returned {0} items", findResults.Items.Count));

                foreach (Item foundItem in findResults.Items)
                {
                    itemIds.Add(foundItem.Id);
                }
            }

            return itemIds;
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:28,代码来源:DumpHelper.cs

示例4: GetFolderItems

        public List<Item> GetFolderItems(Folder folder)
        {
            const int pageSize = 100;
            int offset = 0;
            bool moreItems = true;
            List<Item> result = new List<Item>(folder.TotalCount);
            ItemView oView = new ItemView(pageSize, offset, OffsetBasePoint.Beginning);
            oView.PropertySet = ItemPropertySet;
            while (moreItems)
            {
                oView.Offset = offset;
                FindItemsResults<Item> findResult = folder.FindItems(oView);
                result.AddRange(findResult.Items);
                if (!findResult.MoreAvailable)
                    moreItems = false;

                if (moreItems)
                    offset += pageSize;
            }
            return result;
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:21,代码来源:ItemOperatorImpl.cs


注:本文中的Folder.FindItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。