创建按类别过滤的搜索文件夹 [英] Create Search Folder that filters by category

查看:66
本文介绍了创建按类别过滤的搜索文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用Outlook加载项,该加载项允许根据某些条件自动创建搜索文件夹,其中一个条件是类别。我有一个服务器端组件,通过使用EWS托管api创建搜索文件夹,但我发现
,而我可以正确创建文件夹,条件不正确,打开搜索时看不到任何项目文件夹,我也不能自定义该文件夹,因为该文件夹禁用了Criteria按钮。

Hello, i'm working on an Outlook add-in that allows to automatically create Search folders based on some criteria, one of which is a Category. I have a server side component which creates the search folders by using the EWS managed api, however i found that while i can create the folder correctly, the criteria is not correct and can't see any items when opening the search folder , neither can i customize the folder as the Criteria button is disabled for that folder.

研究更多内容我发现似乎没有办法通过多值搜索属于类别的属性,请参阅下面的示例

Researching more into this i found that there doesn't seem to be a way to search by a multivalued property like Category, see sample below

var searchFolder =
new
SearchFolder (service);

var searchCriteria =

SearchFilter ContainsSubstring ItemSchema 。Categories,
"Customers");

var searchCriteria = new SearchFilter.ContainsSubstring(ItemSchema.Categories, "Customers");

searchFolder.SearchParameters.RootFolderIds.Add( WellKnownFolderName 。收件箱);

searchFolder.SearchParameters.Traversal =
SearchFolderTraversal 。浅;

searchFolder.SearchParameters.SearchFilter = searchCriteria;

searchFolder.DisplayName ="Customers";

               

searchFolder.Save( WellKnownFolderName 。SearchFolders);

这不起作用  SearchFilter ContainsSubstring ItemSchema 。Categories,
"Customers")没有为Categories案例中的Search Folder创建有效的过滤器,它确实适用于Subject / Body / etc之类的简单属性



我一直在寻找如何在加载项中执行此操作但到目前为止我只找到了查询简单或单值属性(如Subject)的样本,或者身体,这不是我需要的。

This doesn't work as SearchFilter.ContainsSubstring(ItemSchema.Categories, "Customers") doesn't create a valid filter for the Search Folder in the Categories case, it does work for simple properties like Subject/Body/etc

I've been looking on how to do this from within the add-in but so far i have found only samples that query for simple or singlevalued properties like Subject, from or body, which is not what i need.

是否有任何api或功能可用于创建高级过滤器,允许查询类别等多值属性?

我还需要保存搜索文件夹,以便它在搜索文件夹下可用,所以基本上我不是在寻找如何执行在运行时在我的代码上返回结果的查询,而是为$用户在Outlook中保留的搜索文件夹创建
正确的过滤器。

有人建议使用MAPI,但我找不到任何关于如何使用这种方法创建或修改搜索文件夹的最新信息。



我想从服务器端创建搜索文件夹,但如果不可能,那么我可以在加载项中创建它。


谢谢你阅读







推荐答案

不了解EWS,但在MAPI级别上,多值字符串属性被视为搜索的单值字符串属性。

Don't know about EWS, but on the MAPI level multivalued string properties are treated as single valued string properties for the searches.

您可以在客户端执行的一些操作

A few things you can do on the client side

1.使用
Application.AdvancedSearch
创建一个搜索文件夹。然后你可以调用
Search.Save
将搜索保存为搜索范围lder。

1. Use Application.AdvancedSearch to create a search folder. You can then call Search.Save to save your search as a search folder.

2。 兑换及其
RDOSearchFolder
对象 - 搜索文件夹通常对最终用户不可见,并在IPM文件夹树之外创建。但是,您可以在任何地方创建搜索文件夹。

2. Redemption and its RDOSearchFolder object - search folders are usually invisible to an end user and are created outside of the IPM folder tree. You can however create a search folder anywhere.

3。 兑换及其
RDOSearch
对象,表示"搜索文件夹"下的Outlook搜索文件夹。 Outlook文件夹树视图中的节点。您可以完全访问搜索(读取现有搜索,修改,创建,删除)。

3. Redemption and its RDOSearch object that represents Outlook search folders under the "Search Folder" node in the Outlook folder tree view. You get full access to the searches (read existing searches, modify, create, delete).


这篇关于创建按类别过滤的搜索文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆