如何使用 ews manage api c# 在 Clutter 文件夹中搜索项目

How to search item in a Clutter folder using ews manage api c#

我可以在 收件箱 中搜索项目,如下所示,使用 EWS 管理 api 过滤器。

static void SearchByUsingFastSearch(ExchangeService service)
        {
            // Return the first 10 items in this call.
            ItemView view = new ItemView(10);

            // Find all items where the body contains "move reports".
            string qstring = "Body:\"move reports\"";

            // Identify the item properties to return.
            view.PropertySet = new PropertySet(BasePropertySet.IdOnly,
                                                ItemSchema.Subject);

            // Send the request and get the results.          
            FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, qstring, view);
        }

以同样的方式,有没有办法在 Clutter 文件夹中找到项目?比如

FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Clutter, qstring, view);

Clutter 文件夹没有枚举器,因为它是最近为 office365 在线引入的,据说可以解决您的问题,您需要按名称查找文件夹,捕获 ID(并将其保存到一个实例变量,供后续使用),然后在其中查找项目。

例如

        ExtendedPropertyDefinition ClutterFolderEntryId = new ExtendedPropertyDefinition(new Guid("{23239608-685D-4732-9C55-4C95CB4E8E33}"), "ClutterFolderEntryId", MapiPropertyType.Binary);
        PropertySet iiips = new PropertySet();
        iiips.Add(ClutterFolderEntryId);
        String MailboxName = "jcool@domain.com";
        FolderId FolderRootId = new FolderId(WellKnownFolderName.Root, MailboxName);
        Folder FolderRoot = Folder.Bind(service, FolderRootId, iiips);
        Byte[] FolderIdVal = null;
        if (FolderRoot.TryGetProperty(ClutterFolderEntryId, out FolderIdVal))
        {
            AlternateId aiId = new AlternateId(IdFormat.HexEntryId, BitConverter.ToString(FolderIdVal).Replace("-", ""), MailboxName);
            AlternateId ConvertedId = (AlternateId)service.ConvertId(aiId, IdFormat.EwsId);
            Folder ClutterFolder = Folder.Bind(service, new FolderId(ConvertedId.UniqueId));
            Console.WriteLine("Unread Email in clutter  : " + ClutterFolder.UnreadCount);
        }

来源:http://gsexdev.blogspot.com/2015/01/accessing-clutter-folder-in-ews-in.html

@GlenScales