有什麼方法可以使用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