Search notes:

Office VBA: set Azure Information Protection Label

This simple example tries to demonstrate how a Azure Information Proection label can be assigned to an Excel document (workbook) with Visual Basic for Applications.
option explicit

sub mai() ' {

    dim wb as workbook
    set wb = workbooks.add

    dim guid_internal_use_only as string
        guid_internal_use_only = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

    wb.customDocumentProperties.add "MSIP_Label_" & guid_internal_use_only & "_Enabled", false, msoPropertyTypeString, "true"

    wb.saveAs environ("temp") & "\created-at-" & format(now(), "yyyy-mm-dd_hh-nn")

    debug.print wb.name

end sub ' }
Github repository about-MS-Office-object-model, path: /Office/DocumentProperties/set-Azure-Information-Protection-Label.vb

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1758207665, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/Office/Object-Model/DocumentProperties/set-Azure-Information-Protection-Label(52): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78