【问题标题】:Changing SensitivityLabel in Outlook 365 email with VBA使用 VBA 更改 Outlook 365 电子邮件中的 SensitivityLabel
【发布时间】:2022-10-18 12:25:01
【问题描述】:

如何访问 Outlook 365 中 Office.Sensitivity Label 的方法为新电子邮件创建和设置标签?

查看您将使用的文档

Dim myLabelInfo As Office.LabelInfo
Set myLabelInfo = ActiveDocument.SensitivityLabel.CreateLabelInfo()

创建一个标签对象,但在 Outlook 邮件项或 Outlook 应用程序中没有 activedocument 对象。

Office.SensitivityLabel 成员的对象浏览器视图

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

【问题讨论】:

  • 敏感度标签或任何加密倾向不会在 Outlook 对象模型中公开。

标签: vba azure outlook


【解决方案1】:

我发现的唯一方法是使用 SendKeys,如果标签列表发生变化,这很容易出现问题。

Set Mail_Object = Outlook_App.CreateItem(olMailItem)

With Mail_Object
    
    '
    ' Set the Sensitivity Label - until details on how to access the property directly come to light
    '
    .Display
    
    SendKeys "%h" ' Alt H - gets the home menu
    SendKeys "AY" ' Sensitivity Label
    SendKeys "{DOWN}{DOWN}{ENTER}" ' Change the number of {DOWN} to select a particular value from your list
    
    .Send ' Send it
    
End With

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 2011-09-28
    • 2014-02-14
    • 1970-01-01
    • 2011-12-21
    相关资源
    最近更新 更多