I have a no-code sandbox solution that I use to provision artefacts. One is a document library to which I want to attach a property bag to be set by a user via custom setting page.

I learned that one can not directly attach a property bag to a document library but only to its root folder. I know how to add property bags to items but did not succeed in adding those to a root folder.

Any help appreciated.


I got an answer from Margriet Bruggeman over at msdn: its not possible to declaratively add a property bag to the root folder. However it is via CSOM.

Solution: I - in any case - need a custom list settings link with attached configuration page to set/modify the property bag (via JSOM). Now I will use this very page to first check if there is a property bag and if not I'll simply create it.

| improve this answer | |

You can update the property bag of the root folder of the document library using this code snippet.

    //Load the document library and the root folder objects
    // Create/update the root folder properties
    oDocLib.RootFolder.Properties["Your_Custom_Property"] = "true"; // this is the same command to create and update a propety in  the property bag

The same can be done using javascript also.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.