I'm trying to use my backend CSOM app with context of Site Collection Administrator service account to programmatically set a property bag value to store some settings for my frontend extension app.
I've tried doing it in 2 ways:
web.SetPropertyBagValue("name", "value");
ctx.ExecuteQuery();
and
web.AllProperties["name"] = "value";
web.Update();
ctx.ExecuteQuery();
but in both cases I get the error:
{"Access denied. You do not have permission to perform this action or access this resource."}
Is there really no way a Site Collection Administrator could set a property bag in SharePoint Online? I'm asking this because I've had similar issue when trying to delete a site, in which case according to a few sources on the Internet this operation could also be done only by tenant administrator but I found a method:
ctx.DeleteSiteAsync()
which turned out to be successfully deleting a site without tenant permissions. So I hope maybe there is also a solution here.