Skip to content

Property Bag

Store and retrieve custom key-value pairs on a web (site) using the property bag.


Prerequisites

Requirement Description Reference
Site Owner role Required to set property bag values. Read access to view. SharePoint admin roles

Examples

Step Operation File Required role API reference
1 Get property bag values get_properties.py Read access Property bag REST API
2 Set property bag value set_properties.py Site Owner Property bag REST API

Quick start

from office365.sharepoint.client_context import ClientContext

ctx = ClientContext("https://contoso.sharepoint.com/sites/team").with_client_certificate(
    "contoso.onmicrosoft.com", client_id="client_id", thumbprint="thumbprint", cert_path="./cert.pem"
)

web = ctx.web.get().execute_query()
web.set_property("AllProperties", {"Custom_Config": "value"}).update().execute_query()

API reference