如何在 Outlook.MailItems 中搜索 UserProperty 的名称,而不是它们的值

How to search for the name of the UserProperty in Outlook.MailItems, not their value

背景:

目前我正在搜索 Outlook.MailItems 他们的 UserProperty(这里是 "IsProcessed")等于它的 propertyValue(这里是 true 或 false)。

string propertyValue = "true";
string filter = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/IsProcessed LIKE \'%" + propertyValue + "%\'";

我在 advancedSearch 中使用这个过滤器字符串 link to doc

问题陈述:

我的用例是搜索这些邮件项目是否分配了任何 UserProperty,其中 UserProperty 的名称 = "IsProcessed"。

有什么方法可以使用类似的 DASL 过滤器字符串吗?

谢谢。

不,您需要知道 GUID。 OOM 中的所有用户属性都使用 {00020329-0000-0000-C000-000000000046}(即 PS_PUBLIC_STRINGS)的 GUID。

要查看 属性 的 DASL 名称,请查看带有 OutlookSpy 的现有消息(我是其作者 - select 消息,单击 IMessage 按钮) - 当您 select 一个名为 属性(粗体)的 OutlookSpy 将显示其 GUID、id 和 DASL 名称。

您可以使用以下条件获取具有用户 属性 设置的项目:

string filter = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/IsProcessed IS NOT NULL";

或获取用户 属性 未设置的项目:

string filter = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/IsProcessed IS NULL";

请参阅搜索字符串中的 Is Null 运算符。