Sharepoint 如何使用JSOM在根网站集的属性包中设置属性?

Sharepoint 如何使用JSOM在根网站集的属性包中设置属性?,sharepoint,sharepoint-online,sharepoint-jsom,Sharepoint,Sharepoint Online,Sharepoint Jsom,我正在尝试更新/创建PropertyBag中的属性。 它在经典体验(开发者站点和文档中心)上运行良好,但不允许在现代网站集(根站点、通信站点和团队站点)上启动应用程序,也不允许在PropertyBag中设置属性 当我尝试在安装后运行应用程序根网站集时,它会抛出此错误 Access denied. You do not have permission to perform this action or access this resource. 请告诉我如何在根站点、通信站点和团队站点的属性包中

我正在尝试更新/创建PropertyBag中的属性。 它在经典体验(开发者站点和文档中心)上运行良好,但不允许在现代网站集(根站点、通信站点和团队站点)上启动应用程序,也不允许在PropertyBag中设置属性

当我尝试在安装后运行应用程序根网站集时,它会抛出此错误

Access denied. You do not have permission to perform this action or access this resource.
请告诉我如何在根站点、通信站点和团队站点的属性包中设置属性

代码:


我通过将“CurrentVersion”的值更改为string来解决这个问题,因为属性包不接受整数值。 你也可以查看这个链接。

 var context = SP.ClientContext.get_current();
        var web = LawApp.Repositories.getWeb(context, hostUrl);
        var props = web.get_allProperties();

        props.set_item("CurrentVersion", 2002);
        web.update();
        context.executeQueryAsync(success, fail);