Azure classification using vba

前端 未结 5 766
遥遥无期
遥遥无期 2020-12-11 21:00

I have a macro that creates and saves multiple word and excel documents. Recently, My organisation started using Microsoft Azure protection. It always asks the user to choos

相关标签:
5条回答
  • 2020-12-11 21:09

    I did not find a solution via API either. But I got it working smooth with SendKeys. Not the best solution, but it works. Maybe you have to adjust the characters. Be sure your Outlook email is in foreground. I execute the sendKeys right after ".display".

    sendKeys "%" (ALT)
    sendKeys "R"
    sendKeys "Y1"
    ...
    sendKeys "~" (ENTER)
    

    Outlook Email Example:

    0 讨论(0)
  • 2020-12-11 21:09

    For me, the easiest way to do this is to attach a file that is already with the label that you want to send (e.g. General), and then the email will be already with that label.

    If you are having the pop-up of the Outlook showing up and you don't like it, use the below code:

    With Application
            .ScreenUpdating = False
            .EnableEvents = False
    End With
    
    0 讨论(0)
  • 2020-12-11 21:14

    the below code helps me select a classification on Outlook and sends the mail automatically,

    Application.SendKeys "%s"
    Application.SendKeys "{TAB}"
    Application.SendKeys "{TAB}"
    Application.SendKeys " "       
    Application.SendKeys "%s"
    
    0 讨论(0)
  • 2020-12-11 21:20

    Azure Information Protection (AIP)

    The answer is not currently. See quote below.

    I personally wouldn't have thought this likely given that it is a paid-for security feature.

    Interim solution:

    As an interim solution, depending on your needs, have you considered having your admin set a default classification?

    In addition to manually selecting labels, labels can also be applied in the following ways:

    Your administrator configured a default label, which you can keep or change........

    1. Making sure the scoped policy includes your account.
    2. If you have classify and protect, rather than just protect, more info is here.

    Feedback from Microsoft indicates this ....

    might be solved with the new SDK that supports the programmatic application of labels. However, this SDK not yet available in public preview. You might be able to try it private preview if you ask about it on the Yammer site: https://www.yammer.com/AskIPTeam

    There...

    is User Voice entry for this SDK, ...[which may] be updated when it becomes publically available ...if you vote for it, you also get notified: https://msip.uservoice.com/forums/600097-azure-information-protection/suggestions/19602292-update-the-sdk-api-for-aip-to-include-classificati%C2%A0

    The SDK documentation I saw, seemed to be in relation to C#, but that is just my observation. See developer link.

    Note:

    I did a quick search of their feedback site, Ideas that relate to Azure Information Protection (AIP), for developments, using search terms VBA and programming classification, this yielded nothing.

    This question has now been raised by a user here:

    https://docs.microsoft.com/en-us/information-protection/get-started/infoprotect-tutorial-step4#comme

    Other resources:

    1. Azure Information Protection Developer's Guide
    2. FAQs
    3. Azure Information Protection Blog
    0 讨论(0)
  • 2020-12-11 21:33

    It seems that after more than a year there is still no solution. At least I did not find any native VBA integration for AIP.

    However I found a solution for myself. Basically I create now a draft of a mail manually where I choose the classification manually. This draft remains in a special folder in outlook. Once I need to send a mail via VBA I copy the draft (classification included!), I change recipients, object, body and I am able to send it without user interaction from VBA since the classification is already done.

    Private Sub Email()
        Dim oMailItem As Outlook.MailItem
        'Set oMailItem = Outlook.Application.CreateItem(olMailItem)
        'Choose template according to subject
        'I have one template for each sensitivity classification
        Set oMailItem = getVbaTemplateMail("VBA Template - Sensitivity=General")
        With oMailItem
        .To = "mail@a.b"
        .subject = "Email Test using VBA"
        .Body = "Test"
        .Display
        .Send
        End With
        Set oMailItem = Nothing
    End Sub
    
    Private Function getVbaTemplateMail(subject As String) As Outlook.MailItem
        Dim olFolder  As Outlook.MAPIFolder
        Dim olItem As Outlook.MailItem
        'GetDefaultFolder(16) = Draft folder, "Drafts/VBA Templates" is my VBA Template folder
        Set olFolder = Application.GetNamespace("MAPI").GetDefaultFolder(16).Folders("VBA Templates")
        For Each olItem In olFolder.Items
            Debug.Print olItem.subject ' Print to immediate window
            If olItem.subject = subject Then
                Set getVbaTemplateMail = olItem.Copy
                'If error "Active Inline Response" appears, the mail is open in Outlook, close it first!
                Exit Function
            End If
        Next
    End Function
    
    0 讨论(0)
提交回复
热议问题