/// <summary> /// Find folders with extended filter. /// </summary> /// <param name="exchangeService"></param> /// <returns></returns> public static async Task FindFoldersWithExtendedFilter(ExchangeService exchangeService) { MailFolderView folderView = new MailFolderView(); folderView.PropertySet.Add(MailFolderObjectSchema.TotalItemCount); ExtendedPropertyDefinition extendedPropertyDefinition1 = new ExtendedPropertyDefinition(MapiPropertyType.Integer, 0x0FFE); folderView.PropertySet.Add(extendedPropertyDefinition1); SearchFilter searchfilter = new SearchFilter.IsEqualTo(MailFolderObjectSchema.DisplayName, "Inbox"); FindMailFolderResults findMailFolderResults = await exchangeService.FindFolders("MsgFolderRoot", searchfilter, folderView); }
public async Task Test_FindFoldersWithCustomPageSizeMailFolderView() { ExchangeService service = this.GetExchangeServiceWithUrlValidator( new Uri("https://graph.microsoft.com/v1.0/Users/[email protected]/MailFolders/Inbox/ChildFolders?$top=7&$skip=12")); MailFolderView mailFolderView = new MailFolderView(7, 12); await service.FindFolders( WellKnownFolderName.Inbox, mailFolderView); }
/// <summary> /// Validate if extended properties are pulled from folder. /// </summary> /// <param name="exchangeService"></param> public static async Task GetExtendedPropertyFromFolder(ExchangeService exchangeService) { MailFolderView folderView = new MailFolderView(20); folderView.PropertySet.Add(new ExtendedPropertyDefinition(MapiPropertyType.Binary, 0x0E3F)); foreach (MailFolder folder in await exchangeService.FindFolders(WellKnownFolderName.MsgFolderRoot, folderView)) { Assert.AreEqual( 1, folder.SingleValueExtendedProperties.Count); } }
public async Task Test_FindFoldersWithCustomPageSizeAndProperty() { ExchangeService service = this.GetExchangeServiceWithUrlValidator( new Uri("https://graph.microsoft.com/v1.0/Users/[email protected]/MailFolders/Inbox/ChildFolders?$top=7&$skip=12&$select=Id,ChildFolderCount,DisplayName,ParentFolderId,TotalItemCount")); MailFolderView mailFolderView = new MailFolderView(7, 12); mailFolderView.PropertySet.Add(MailFolderObjectSchema.TotalItemCount); await service.FindFolders( WellKnownFolderName.Inbox, mailFolderView); }
public async Task Test_FindFoldersWithCustomPageSizeAndPropertyExtendedProperty() { ExchangeService service = this.GetExchangeServiceWithUrlValidator( new Uri("https://graph.microsoft.com/v1.0/Users/[email protected]/MailFolders/Inbox/ChildFolders?$top=7&$skip=12&$select=Id,ChildFolderCount,DisplayName,ParentFolderId,TotalItemCount&$expand=SingleValueExtendedProperties($filter=Id eq 'Double 0x1234')")); MailFolderView mailFolderView = new MailFolderView(7, 12); mailFolderView.PropertySet.Add(MailFolderObjectSchema.TotalItemCount); mailFolderView.PropertySet.Add(new ExtendedPropertyDefinition(MapiPropertyType.Double, 0x1234)); await service.FindFolders( WellKnownFolderName.Inbox, mailFolderView); }
/// <summary> /// Find folders. /// </summary> /// <param name="exchangeService">Exchange service.</param> /// <returns></returns> public static async Task FindFolders(ExchangeService exchangeService) { // TODO: Finish test. FindMailFolderResults findMailFolderResults = await exchangeService.FindFolders(WellKnownFolderName.MsgFolderRoot, new MailFolderView()); MailFolderView folderView = new MailFolderView(); folderView.PropertySet.Add(MailFolderObjectSchema.TotalItemCount); ExtendedPropertyDefinition extendedPropertyDefinition1 = new ExtendedPropertyDefinition(MapiPropertyType.Long, 0x340F); folderView.PropertySet.Add(extendedPropertyDefinition1); SearchFilter searchfilter = new SearchFilter.IsEqualTo(MailFolderObjectSchema.DisplayName, "Inbox"); findMailFolderResults = await exchangeService.FindFolders("MsgFolderRoot", searchfilter, folderView); }
/// <summary> /// Get mail folders request. /// </summary> public static async Task GetMailFolders(ExchangeService exchangeService) { FindMailFolderResults findFoldersResults = null; MailFolderView folderView = new MailFolderView(10, 0); do { findFoldersResults = await exchangeService.FindFolders(WellKnownFolderName.MsgFolderRoot, folderView); folderView.Offset += folderView.PageSize; foreach (MailFolder folder in findFoldersResults) { Assert.IsNotNull(folder.EntityService); } } while (findFoldersResults.MoreAvailable); }