Setting PropertyBag Property without allowing custom scripts

Martin Ewald 20 Reputation points
2024-07-04T12:35:08.1166667+00:00

We are setting Propery Bag values of a Sharepoint Online Web from an Azure Function using the Microsoft.SharePoint.Client (Microsoft.SharePointOnline.CSOM) Library with the SetPropertyBagValue.

For setting a Property Bag value the "Allow Custom script" property must be set to true otherwise a "Access denied" Exception is thrown.

Currently Microsoft is phasing out the "Allow Custom Scripts" setting. This means that by November 2024 the "Allow Custom Script" option will be reset after 24 hours.

I don't want to temporarily set the "Allow Script" property as i suspect that this will lead to timing issues.

Is there a way to still set a property bag value after november in a recommended and stable way?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,611 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,819 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 25,456 Reputation points Microsoft Vendor
    2024-07-05T02:52:22.0066667+00:00

    Hi @Martin Ewald

    As you said, after November 2024, the "Allow custom script" option will reset after 24 hours.

    Unfortunately, there is currently no recommended and stable way to set property bag values ​​without temporarily setting the "Allow Script" property.

    To address your concern about the situation, we’d suggest you go to feedback on this issue, this is the best platform to let us hear from you and make our products and services better for you and others.

    Have a nice day!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.