vb.net:发送带有敏感度标签的电子邮件

问题描述 投票:0回答:1

我在工作中有一个应用程序,它通过我电脑上的 Outlook 客户端创建新的 html 邮件消息。 安全策略要求我为每封邮件设置敏感度标签。 我尝试使用此代码,但它不起作用,因为出现新邮件时没有敏感度标签。有人可以帮助我吗?我无权进行管理配置/powershell 或其他任何操作.. 谢谢

Try
Dim Outlook_App As New Microsoft.Office.Interop.Outlook.Application
Dim Outlook_Message As Microsoft.Office.Interop.Outlook.MailItem




            Outlook_Message = Outlook_App.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
            Outlook_Message.Sensitivity = Microsoft.Office.Interop.Outlook.OlSensitivity.olConfidential

            Outlook_Message.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML
            Outlook_Message.Subject = "Orientamento treno " & numerotreno & " del " & Today.ToShortDateString
            Outlook_Message.HTMLBody = emailTemplate



            Outlook_Message.To = "[email protected]"
            'con questa procedeura faccio inviare la mail dall'account che corrisponde a quest'indirizzo

            Dim account As Microsoft.Office.Interop.Outlook.Account

            For Each account In Outlook_App.Session.Accounts
                If account.DisplayName = "[email protected]" Then

                    Outlook_Message.SendUsingAccount = account
                    Outlook_Message.Sensitivity = Microsoft.Office.Interop.Outlook.OlSensitivity.olConfidential
                End If
            Next

            Outlook_Message.Display(False)
vb.net outlook office365 office-automation azure-information-protection
1个回答
0
投票

MailItem.Sensitivity 属性返回或设置 OlSensitivity 枚举中的常量,指示 Outlook 项目的敏感度。这是纯粹的 Outlook 标签,与敏感度标签和 Azure 信息保护无关。

您需要添加以下格式的用户属性:

"MSIP_Label_" & guid_internal_use_only & "_Enabled"

寻找用于此类任务的

UserProperties.Add
方法。

但我建议使用 MFCMAPI

OutlookSpy
探索 Outlook 邮件项目的内部结构,以找到确切的解决方案。尝试手动设置它,然后使用这些工具探索内部结构。

© www.soinside.com 2019 - 2024. All rights reserved.