问题描述
全部,
我们使用Managed API创建了一个搜索文件夹,后面是代码。此搜索文件夹搜索MailBox文件夹中存在MyCustomProperty且不等于空白的所有项目。由于此文件夹包含大量项目,因此我们需要在MyCustomProperty上提供默认分组和排序。有没有人可以告诉我是否有任何方法可以使用Managed API实现这一目标?
ExchangeService服务=新的ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential ("userid","密码","域名");
service.AutodiscoverUrl(" ");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress," ");
//创建搜索文件夹
SearchFolder srchFldr = new SearchFolder(service);
SearchFilter.SearchFilterCollection srchFilter =
新的SearchFilter.SearchFilterCollection(
LogicalOperator.And);
ExtendedPropertyDefinition exPropDef = new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.PublicStrings," MyCustomProperty",MapiPropertyType.String);
srchFilter。添加(new SearchFilter.Exists(exPropDef));
srchFilter.Add(new SearchFilter.IsNotEqualTo(exPropDef," " .ToString());;
srchFldr.SearchParameters.RootFolderIds.Add(WellKnownFolderName.MsgFolderRoot);
srchFldr.SearchParameters.Traversal = SearchFolderTraversal.Deep;
srchFldr.SearchParameters.SearchFilter = srchFilter;
srchFldr.DisplayName =" ManageAPIFldr";
srchFldr.Save(WellKnownFolderName.SearchFolders);
All,
We have created a search folder using Managed API and follwing is the code. This search folder searches all the items in the MailBox folder where MyCustomProperty exists and is not equal to blank. Since this folder would contain lot of items, we need to provide the default grouping and sorting on the MyCustomProperty. Could anyone please let me know if there is any way to accomplish that using Managed API?
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential("userid", "password", "domain" );
service.AutodiscoverUrl("[email protected]");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]");
//Creating Search Folder
SearchFolder srchFldr = new SearchFolder(service);
SearchFilter.SearchFilterCollection srchFilter =
new SearchFilter.SearchFilterCollection(
LogicalOperator.And);
ExtendedPropertyDefinition exPropDef = new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.PublicStrings, "MyCustomProperty", MapiPropertyType.String);
srchFilter.Add(new SearchFilter.Exists(exPropDef));
srchFilter.Add(new SearchFilter.IsNotEqualTo(exPropDef, " ".ToString()));
srchFldr.SearchParameters.RootFolderIds.Add(WellKnownFolderName.MsgFolderRoot);
srchFldr.SearchParameters.Traversal = SearchFolderTraversal.Deep;
srchFldr.SearchParameters.SearchFilter = srchFilter;
srchFldr.DisplayName = "ManageAPIFldr";
srchFldr.Save(WellKnownFolderName.SearchFolders);
这篇关于通过托管API创建的搜索文件夹的默认分组和排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!