2016-05-27 14 views
1

の受信トレイのアイテムは、EWS manage APIを使用して次のように検索できます。同じようにews manage apiを使用してClutterフォルダ内のアイテムを検索する方法C#

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); 
     } 

クラッタフォルダ内のアイテムを検索する方法はありますか?それは最近だったので

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

答えて

1

のようなものがクラッタフォルダの列挙子はありませんoffice365オンラインで導入されました。問題を解決するために名前でフォルダを探し、IDを取得してインスタンス変数に保存してからアイテムを探します。

Ex。

 ExtendedPropertyDefinition ClutterFolderEntryId = new ExtendedPropertyDefinition(new Guid("{23239608-685D-4732-9C55-4C95CB4E8E33}"), "ClutterFolderEntryId", MapiPropertyType.Binary); 
     PropertySet iiips = new PropertySet(); 
     iiips.Add(ClutterFolderEntryId); 
     String MailboxName = "[email protected]"; 
     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

関連する問題