'Changing SensitivityLabel in Outlook 365 email with VBA
How can I access the methods of Office.SensitivityLabel in Outlook 365 that will allow me to create and set a label for a new email. Looking at the (sparse) docs for this you would use
Dim myLabelInfo As Office.LabelInfo
Set myLabelInfo = ActiveDocument.SensitivityLabel.CreateLabelInfo()
to create a label object but there's no activedocument object in an Outlook mailitem, or in the Outlook application.
Object Browser view of Office.SensitivityLabel members
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = myRecipients
.Subject = mySubject
.BodyFormat = olFormatHTML
.HTMLBody = myEmailBody
'' Set Office.SensitivityLabel // how do I set the label ?
.Send
End With
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|