有什么方法可以使用Outlook对象模型设置Outlook文件夹或子文件夹的自定义图标吗?如何设置Outlook文件夹的自定义图标?
回答
从我读这是不幸的是不可能在Outlook 2007中
它使用MAPIFolder.SetCustomIcon
是在Outlook 2010中可能的。查看MSDN了解更多详细信息:http://msdn.microsoft.com/en-us/library/ff184775.aspx
切换以下MSDN网页2010年和2007年之间MAPIFolder方法列表显示仅2010年SetCustomIcon
方法:http://msdn.microsoft.com/en-us/library/bb645002.aspx
由于从Outlook 2010,您可以使用MAPIFolder.SetCUstomIcon
如上所述。
最近我有同样的挑战和发现的VBA代码一个很好的片段在 Change Outlook folders colors possible?:
joelandreJan 12, 2015 at 9:13 PM
- 将文件解压缩icons.zip到C:\图标
- 将以下代码定义为Visual Basic Mac ROS
根据您的需要文本
Function GetFolder(ByVal FolderPath As String) As Outlook.folder ' Returns an Outlook folder object basing on the folder path ' Dim TempFolder As Outlook.folder Dim FoldersArray As Variant Dim i As Integer On Error GoTo GetFolder_Error 'Remove Leading slashes in the folder path If Left(FolderPath, 2) = "\\" Then FolderPath = Right(FolderPath, Len(FolderPath) - 2) End If 'Convert folderpath to array FoldersArray = Split(FolderPath, "\") Set TempFolder = Application.Session.Folders.Item(FoldersArray(0)) If Not TempFolder Is Nothing Then For i = 1 To UBound(FoldersArray, 1) Dim SubFolders As Outlook.Folders Set SubFolders = TempFolder.Folders Set TempFolder = SubFolders.Item(FoldersArray(i)) If TempFolder Is Nothing Then Set GetFolder = Nothing End If Next End If 'Return the TempFolder Set GetFolder = TempFolder Exit Function GetFolder_Error: Set GetFolder = Nothing Exit Function End Function Sub ColorizeOneFolder(FolderPath As String, FolderColour As String) Dim myPic As IPictureDisp Dim folder As Outlook.folder Set folder = GetFolder(FolderPath) Set myPic = LoadPicture("C:\icons\" + FolderColour + ".ico") If Not (folder Is Nothing) Then ' set a custom icon to the folder folder.SetCustomIcon myPic 'Debug.Print "setting colour to " + FolderPath + " as " + FolderColour End If End Sub Sub ColorizeFolderAndSubFolders(strFolderPath As String, strFolderColour As String) ' this procedure colorizes the foler given by strFolderPath and all subfolfers Dim olProjectRootFolder As Outlook.folder Set olProjectRootFolder = GetFolder(strFolderPath) Dim i As Long Dim olNewFolder As Outlook.MAPIFolder Dim olTempFolder As Outlook.MAPIFolder Dim strTempFolderPath As String ' colorize folder Call ColorizeOneFolder(strFolderPath, strFolderColour) ' Loop through the items in the current folder. For i = olProjectRootFolder.Folders.Count To 1 Step -1 Set olTempFolder = olProjectRootFolder.Folders(i) strTempFolderPath = olTempFolder.FolderPath 'prints the folder path and name in the VB Editor's Immediate window 'Debug.Print sTempFolderPath ' colorize folder Call ColorizeOneFolder(strTempFolderPath, strFolderColour) Next For Each olNewFolder In olProjectRootFolder.Folders ' recursive call 'Debug.Print olNewFolder.FolderPath Call ColorizeFolderAndSubFolders(olNewFolder.FolderPath, strFolderColour) Next End Sub Sub ColorizeOutlookFolders() Call ColorizeFolderAndSubFolders("\\Personal\Documents\000-Mgmt-CH\100-People", "blue") Call ColorizeFolderAndSubFolders("\\Personal\Documents\000-Mgmt-CH\200-Projects","red") Call ColorizeFolderAndSubFolders("\\Personal\Documents\000-Mgmt-CH\500-Meeting", "green") Call ColorizeFolderAndSubFolders("\\Personal\Documents\000-Mgmt-CH\800-Product", "magenta") Call ColorizeFolderAndSubFolders("\\Personal\Documents\000-Mgmt-CH\600-Departments", "grey") Call ColorizeFolderAndSubFolders("\\Mailbox - Dan Wilson\Inbox\Customers", "grey") End Sub
在对象ThisOutlookSession适应功能ColorizeOutlookFolders,定义了以下功能:
Private Sub Application_Startup() ColorizeOutlookFolders End Sub
和
为了不着色子文件夹,您可以使用功能 ColorizeOneFolder而不是ColorizeFolderAndSubFolders,例如
Sub ColorizeOutlookFolders() Call ColorizeOneFolder ("\\Personal\Documents\000-Mgmt-CH\100-People", "blue") Call ColorizeOneFolder ("\\Personal\Documents\000-Mgmt-CH\200-Projects", "red") Call ColorizeOneFolder ("\\Personal\Documents\000-Mgmt-CH\500-Meeting", "green") Call ColorizeOneFolder ("\\Personal\Documents\000-Mgmt-CH\800-Product", "magenta") Call ColorizeOneFolder ("\\Personal\Documents\000-Mgmt-CH\600-Departments", "grey") Call ColorizeOneFolder ("\\Mailbox - Dan Wilson\Inbox\Customers", "grey") End Sub
当文件夹之间移动子文件夹时,应保留其 颜色只有你重新启动Outlook,直到下一次。
由于链接腐烂可能占上风,我在脚本中进行了编辑。 – 2016-01-22 15:28:25
- 1. 如何在Outlook中设置自定义图标IPM.Document项目
- 2. Outlook文件夹自定义UI
- 3. IntelliJ的自定义文件夹图标
- 4. 如何以编程方式在GNOME中设置自定义文件夹图标?
- 5. C#如何设置文件夹图标?
- 6. 如何识别Outlook中的“我的”自定义文件夹AddIn
- 7. 自定义Windows文件夹图标
- 8. 如何为dll文件设置自定义图标?
- 9. 设置自定义图标
- 10. 如何确定文件夹是否有自定义图标?
- 11. 当项目移动到Outlook中的文件夹时设置自定义值
- 12. 如何通过Python自定义文件夹的图标?
- 13. 如何使用`UIFileSharingEnabled = YES`设置自定义文件夹?
- 14. 如何在我的自定义项目的Outlook资源管理器窗口中设置自定义图标?
- 15. 如何在wordpress中设置自定义插件上的图标
- 16. 以编程方式在Linux中设置自定义文件夹/目录图标
- 17. 自定义设置文件
- 18. 自定义位置设置git的文件夹
- 19. 设置Mac文件夹的图标
- 20. 设置一个文件夹的图标
- 21. 如何捕获自定义文件夹上的Outlook约会删除事件?
- 22. FileWriter:如何设置目标文件夹?
- 23. 如何设置Outlook互联网日历文件夹的地址?
- 24. Outlook Web Add-in中的自定义文件夹/收件箱视图
- 25. 将数据写入文件并设置自定义图标
- 26. 将图标设置为自定义QFontDialog
- 27. Delphi自定义表单图标设置
- 28. 循环在选定的Outlook文件夹中设置手表
- 29. 如何将文件夹图标设置为JPEG图像?
- 30. 如何设置图表js自定义
您定位的是哪个版本的Outlook,并且您是否有要使用的语言? – 2010-01-10 07:57:23
我使用Outlook 2007和C# – m23 2010-01-10 14:30:55