首页 > 解决方案 > 拒绝访问。您无权执行此操作或访问此资源设置属性包时

问题描述

我正在使用 azure ad 来获取共享点上下文,并在 Azure 函数中管理网站集。但是当我尝试设置属性包时,它失败了。我的天蓝色广告应用程序完全控制了网站权限。

Sites.FullControl.All
Application
Have full control of all site collections
Yes



using (ClientContext context = spHelper.GetAzureADOnlyClientContext(hostUrl, spAzureAppId, spTenant, certificate, false))
                {
                    tenant.SetSiteAdmin(hostUrl, siteCreationInfo.TechnicalOwnerEmail, true);
                    admClientContext.ExecuteQuery();

                    string description = siteCreationInfo.Description;
                    if (!string.IsNullOrWhiteSpace(description))
                    {
                        //setting the propertyBag to flag the site created by CDA
                        context.Site.RootWeb.AllProperties["Createdby"] = "CDA-V0.5";
                        context.Site.RootWeb.Description = description;
                        context.Site.RootWeb.Update();
                    }
                    try
                    {
                        if (context.HasPendingRequest)
                        {
                            context.ExecuteQuery();
                        }
                        logHelper.writeLog("Site updated!");
                    }
                    catch (Exception ex)
                    {
                        logHelper.writeLog("Update site error:" + ex.Message);
                        throw;
                    }
                }

我会错过更多设置吗?

标签: sharepointazure-active-directoryazure-functionssharepoint-online

解决方案


推荐阅读