【发布时间】:2021-09-02 18:27:06
【问题描述】:
要将Items.Sort 方法与自定义字段一起使用,我首先在一些邮件项中添加了一个新的UserProperty:
Set oUserProp = oSentItem.UserProperties.Add("AAA", OlUserPropertyType.olText, AddToFolderFields:=False, _
DisplayFormat:=OlFormatText.olFormatTextText)
oUserProp .Value = "AAA"
由于我使用了AddToFolderFields:=False,然后我将相同的属性添加到已发送文件夹:
Set oUserDefinedProp = oNS.GetDefaultFolder(OlDefaultFolders.olFolderSentMail).UserDefinedProperties.Add( _
Name:="AAA", Type:=OlUserPropertyType.olText, DisplayFormat:=OlFormatText.olFormatTextText, Formula:="")
然后检索我使用的邮件:
oSentItems.Sort Property:="AAA", Descending:=False
Set oSentItem = oSentItems.GetLast
oSentItems.Sort Property:="[AAA]", Descending:=False
Set oSentItem = oSentItems.GetLast
我做了几次这个测试,使用“AAA”和“[AAA]”作为属性名称,我还在 Outlook UI 的已发送文件夹视图中直接添加了一个名为“AAA”的新列。
我删除了oSentFolder.UserDefinedProperties 和oSentFolder.UserDefinedProperties.Count = 0 中的UserDefinedProperty。但是,在 MFCMAPI 中,在 Sent Folder > Table > Set columns... > Property Tag Array 下,我无法摆脱相应的命名属性,这些属性显然在字符串命名空间(PS_PUBLIC_STRING 属性集)。我试图从 MFCMAPI 中删除它们,然后单击确定,但它们每次都会回来。
从 Outlook VBA 我尝试了以下,但找不到属性。
oSentFolder.PropertyAccessor.DeleteProperty "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/AAA"
oSentFolder.PropertyAccessor.DeleteProperty "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/[AAA]"
oSentFolder.PropertyAccessor.DeleteProperty "http://schemas.microsoft.com/mapi/proptag/0x8750001F"
oSentFolder.Items.ResetColumns
我不能使用 OutlookSpy,只能使用不需要安装的 MFCMAPI。
【问题讨论】: