Forum Discussion
Apply default compliance label to document library from code (SPO)
- Mar 05, 2018
I don't think there is a way (yet) to set this property at the library-level. I've checked to see what happens exactly when you set the property using the browser interface. I've noticed differences in the List's Schema XML before and after changing the configuration through the browser. Unfortunately you cannot change the List's Schema XML programmatically and there are no Properties on List that let you change the settings.
However, you can set the Compliance Label programmatically at the item-level:
https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.listitem.setcompliancetag.aspx
So (for the time being) you could write a Web Hook or other kind of scheduled / triggered mechanism that uses this API to ensure your documents are properly labeled. You could even call this API from PowerShell if you'd whish.
Hope this helps
I don't think there is a way (yet) to set this property at the library-level. I've checked to see what happens exactly when you set the property using the browser interface. I've noticed differences in the List's Schema XML before and after changing the configuration through the browser. Unfortunately you cannot change the List's Schema XML programmatically and there are no Properties on List that let you change the settings.
However, you can set the Compliance Label programmatically at the item-level:
https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.listitem.setcompliancetag.aspx
So (for the time being) you could write a Web Hook or other kind of scheduled / triggered mechanism that uses this API to ensure your documents are properly labeled. You could even call this API from PowerShell if you'd whish.
Hope this helps