答案 0 :(得分:1)
您可以更改图标,但是可以选择图标。您将需要使用C#或VB.NET(例如VSTO Outlook-addin)或VBA。
我找不到可以使用的图标值列表,但这是旧列表的图像-以防链接丢失。
Source of the image and also partly answering your question.
要更改图标,您需要使用MailItem.PropertyAccessor
示例实例常量(这些是十六进制值,但是您也可以使用Long)
Const OL_PHONE = &H15D
Const OL_GROUP = &H202
Const OL_NOTE = &H1BD
Const PR_ICON_INDEX As String = "http://schemas.microsoft.com/mapi/proptag/0x10800003"
使用以下辅助方法
'use the Get to see the value of an icon
'prior to this code you would need to get a reference to an Outlook mailitem
Dim res As New Object
GetExtendedPropertyValue(oMailItem, PR_ICON_INDEX, res)
'check the value of res or call Hex(res) to see its hex value
'here you can set the icon eg OL_GROUP etc
SetExtendedPropertyValue(oMailItem, PR_ICON_INDEX, OL_PHONE)
我已经建立了一对辅助方法
Private Function GetExtendedPropertyValue(ByVal aMailItem As Outlook.MailItem, ByVal aProperty As String, ByRef res As Object) As Boolean
Dim oPropAcc As Outlook.PropertyAccessor = Nothing
Try
oPropAcc = DirectCast(aMailItem.PropertyAccessor, Outlook.PropertyAccessor)
res = oPropAcc.GetProperty(aProperty)
Return True
Catch ex As System.Exception
'Put your own logging here
Finally
If Not oPropAcc Is Nothing Then
Marshal.ReleaseComObject(oPropAcc)
oPropAcc = Nothing
End If
End Try
Return False
End Function
Private Function SetExtendedPropertyValue(ByVal aMailItem As Outlook.MailItem, ByVal aProperty As String, ByVal value As Integer) As Boolean
Dim oPropAcc As Outlook.PropertyAccessor = Nothing
Try
oPropAcc = DirectCast(aMailItem.PropertyAccessor, Outlook.PropertyAccessor)
oPropAcc.SetProperty(aProperty, value)
Return True
Catch ex As System.Exception
'Put your own logging here
Finally
If Not oPropAcc Is Nothing Then
Marshal.ReleaseComObject(oPropAcc)
oPropAcc = Nothing
End If
End Try
Return False
End Function
这三个例子是这样的
可以在这里找到PR_ICON_INDEX PidTagIconIndex Canonical Property,请注意,他们确实会说
此属性(如果存在)是对客户端的提示。客户端可能会忽略此属性的值。
但是事实并非如此。
当然,图标更改不会是永久的。如果用户转发电子邮件或回复,则将被更改。
编辑 顺便说一句,这是找出可能图标的好方法。创建一个临时文件夹,然后将垃圾电子邮件复制到该文件夹2048次。然后运行这段代码
Public Sub PrIconIndex()
USE THIS MACRO WITH CARE!
Dim objItems As Items
Dim mail As MailItem
Dim i As Integer
Set objItems = Application.ActiveExplorer.CurrentFolder.Items
For i = 1 To 2048
Set mail = objItems(i)
Call mail.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10800003", i)
mail.Body = CStr(i)
mail.Save
Next
End Sub
以上内容来自this forum link
答案 1 :(得分:0)
当前没有用于向Outlook项目添加自定义图标的功能。我们在user-voice page上跟踪Outlook加载项功能请求。请在此处添加您的请求。当我们进行规划过程时,会考虑用户语音上的功能请求。