Support Default Label for emails sent programmatically
When you don't select a default label, users are required to manually select a label. Although this is great for live users, it interferes with bulk email distribution scripts, because the process stops to wait for the selection of a label for each automatically generated email. We need to assign a default label that applies only for bulk email processes. Either that, or provide standard code that can be included in bulk email scripts to enable the assignment of an appropriate default label.
Is there any update on this, as I am also trying to get this to work and the example does not - not least because the namespace string is incomplete...
ist the nameSpace correct?
how should see the correct Value of labelPublic?
labelPublic = "MSIP_Label_abcdefgh_Enabled=True;" or
labelPublic = "abcdefgh_Enabled=True;"
The code doesnt work by me :-(
How do you determine the GUIDs for your security labels?
Keith Adley commented
try this - its crude but works - it can be easily tidied up to make selection of classification much easier. Change label names and insert your relevant GUIDS as needed.
Dim myItem As Object
Dim nameSpace, labelPublic, labelInternal, labelConfidential, labelExternal, labelStrictly As String
labelPublic = "MSIP_Label_your_label_guid_here_Enabled=True;"
labelInternal = "MSIP_Label_your_label_guid_here_Enabled=True;"
labelConfidential = "MSIP_Label_your_label_guid_here_Enabled=True;"
labelExternal = "MSIP_Label_your_label_guid_here_Enabled=True;"
labelStrictly = "MSIP_Label_your_label_guid_here_Enabled=True;"
Set myItem = Application.CreateItem(olMailItem)
myItem.Subject = "Outlook Automation with AIP"
myItem.To = "email@example.com"
myItem.Body = "Testing AIP Outlook message created by VBA code - hooray!!! At last Success"
'myItem.PropertyAccessor.SetProperty nameSpace, labelPublic 'Public
'myItem.PropertyAccessor.SetProperty nameSpace, labelInternal 'For internal use only
'myItem.PropertyAccessor.SetProperty nameSpace, labelConfidential 'Confidential
'myItem.PropertyAccessor.SetProperty nameSpace, labelExternal 'External Communication
myItem.PropertyAccessor.SetProperty nameSpace, labelStrictly 'Strictly Confidential