Set Macro Security Settings via API

Set Macro Security Settings via API

lwlXUTTT
Advocate Advocate
179 Views
1 Reply
Message 1 of 2

Set Macro Security Settings via API

lwlXUTTT
Advocate
Advocate

Dear all,

is it possibly to set those macro securuty settings via API?

 

lwlXUTTT_0-1713995714062.png

 

0 Likes
180 Views
1 Reply
Reply (1)
Message 2 of 2

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @lwlXUTTT ,

 

Please add the RevitAPIMacros.dll and RevitAPIUIMacros.dll to your project.
Use the following code to configure the application and document macro security settings.

Document doc = commandData.Application.ActiveUIDocument.Document;

//Set application macro security settings
Application app = doc.Application;
MacroManager.SetApplicationMacroSecurityOptions(app,ApplicationMacroOptions.DisableMacros);
           

//Set document macro security settings            
UIMacroManager.SetUIDocumentMacroSecurityOptions(commandData.Application, UIDocumentMacroOptions.DisableMacros);

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network