错误:异常调用“executequery”用“0”表示“0”。参数:“远程服务器返回错误:(403)禁止。” [英] Error : exception calling "executequery" with "0" argument(s): "the remote server returned an error: (403) forbidden."
本文介绍了错误:异常调用“executequery”用“0”表示“0”。参数:“远程服务器返回错误:(403)禁止。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tenant.sharepoint.com/sites/mysitecollection" $username = "username@tenant.onmicrosoft.com" $password = Read-Host -Prompt "Enter password" -AsSecureString
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials
$webCreationInformation = New-Object Microsoft.SharePoint.Client.WebCreationInformation $webCreationInformation.Url = "site1" $webCreationInformation.Title = "Site 1" $webCreationInformation.WebTemplate = "STS#0" $newWeb = $ctx.Web.Webs.Add($webCreationInformation)
$ctx.Load($newWeb)
$ctx.ExecuteQuery() Write-Host "Title" $newWeb.Title
am i missing something? i'm global administrator for my o365 tenant & sharepoint admin in sharepoint online. still getting this error : Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (403) Forbidden."
我尝试了什么:
我尝试使用0365中添加新的全局管理员用户然后将他导入sharepoint Admin组。
What I have tried:
I tried using adding new global administrator user in 0365 and then import him into sharepoint Admin group.
推荐答案
siteUrl = https://tenant.sharepoint.com/sites/mysitecollection
siteUrl = "https://tenant.sharepoint.com/sites/mysitecollection"
username = username@tenant.onmicrosoft.com
username = "username@tenant.onmicrosoft.com"
password = Read-Host -Prompt 输入密码 -AsSecureString
password = Read-Host -Prompt "Enter password" -AsSecureString
这篇关于错误:异常调用“executequery”用“0”表示“0”。参数:“远程服务器返回错误:(403)禁止。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文