Set multiple outlook categories

人走茶凉 提交于 2019-12-13 06:17:20

问题


I'm attempting to work with Outlook using VBScript to change the categories on an email based on certain criteria. My problem is I can't figure out how VBScript handles interacting with Outlook for assigning multiple categories.

Set objOutlook   = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objMailbox   = objNamespace.Folders("team")
Set objFolder = objMailbox.Folders("Inbox").Folders.Item("test")
Set colItems = objFolder.Items
mycount = objFolder.Items.Count

If objItem.Categories = "Purple Category" Then
    objItem.Categories = "Purple Category, Green Category"

But that isn't working. Any ideas anyone?


回答1:


The categories must be separated with ";". You also need to save the item:

If objItem.Categories = "Purple Category" Then
    objItem.Categories = "Purple Category;Green Category"
    objItem.Save
End If


来源:https://stackoverflow.com/questions/39781356/set-multiple-outlook-categories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!