使用比较运算符在Outlook C中创建自定义字段筛选器#

使用比较运算符在Outlook C中创建自定义字段筛选器#,outlook,vsto,outlook-addin,Outlook,Vsto,Outlook Addin,我已经创建了一个过滤器,可以比较自定义用户属性的值,并只显示符合要求的电子邮件 当我有=比较值时,过滤器工作,但当我有 这里的60不是一个数字,而是一个字符串。所以,基本上,两个字符串是比较的 MailUserProperty = MailUserProperties.Add("TimeSpent", Outlook.OlUserPropertyType.olText, true, 1); 添加字符串用户属性,然后要应用比较器。只有整数值才有意义。因此,代码应该如下所示: MailUser

我已经创建了一个过滤器,可以比较自定义用户属性的值,并只显示符合要求的电子邮件

当我有
=
比较值时,过滤器工作,但当我有

这里的
60
不是一个数字,而是一个字符串。所以,基本上,两个字符串是比较的

 MailUserProperty = MailUserProperties.Add("TimeSpent", Outlook.OlUserPropertyType.olText, true, 1);
添加字符串用户属性,然后要应用比较器。只有整数值才有意义。因此,代码应该如下所示:

 MailUserProperty = MailUserProperties.Add("TimeSpent", Outlook.OlUserPropertyType.olInteger, true, 1);
只有这样,您才能尝试使用以下过滤器:

 string filter= $"@SQL=\"http://schemas.microsoft.com/mapi/string/{{00020329-0000-0000-C000-000000000046}}/TimeSpent/0000001f\" <= 60";

stringfilter=$”@SQL=\“http://schemas.microsoft.com/mapi/string/{{00020329-0000-0000-C000-0000000000 46}/TimeSpent/0000001f\“我在进行更改后面临的一个问题是,到目前为止,我已将所有数据记录在“TimeSpent”中“用户属性是文本格式,但现在我录制的是整数。我得到了这个错误,
一个具有这个名称的自定义字段,但是已经存在一个不同的数据类型。请输入其他名称。
是否有任何方法可以在不提供新名称的情况下以整数形式记录新数据?
 string filter= $"@SQL=\"http://schemas.microsoft.com/mapi/string/{{00020329-0000-0000-C000-000000000046}}/TimeSpent/0000001f\" = '60'";
 MailUserProperty = MailUserProperties.Add("TimeSpent", Outlook.OlUserPropertyType.olText, true, 1);
 MailUserProperty = MailUserProperties.Add("TimeSpent", Outlook.OlUserPropertyType.olInteger, true, 1);
 string filter= $"@SQL=\"http://schemas.microsoft.com/mapi/string/{{00020329-0000-0000-C000-000000000046}}/TimeSpent/0000001f\" <= 60";