问题
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