我想使用CSOM设置特定子站点的组所有者。使用Powershell和CSOM检索Sharepoint联机组
我的网站收藏路径是“https://mytenant.sharepoint.com/”。
子站点路径“https://mytenant.sharepoint.com/subsite”。
首先我要检索我的特定子站点的SharePoint组,但我的代码检索我的收集站点的所有子站点组。
这里是我的代码:
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://mytenant.sharepoint.com/subsite"
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
$userId = "myID"
$pwd = Read-Host -Prompt "Enter password" -AsSecureString
$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userId, $pwd)
$ctx.credentials = $creds
$web = $ctx.web
$groups = $web.SiteGroups
$ctx.Load($groups)
$ctx.ExecuteQuery()
foreach($group in $groups){
Write-Host "Site Group : " $group.Title
$ctx.ExecuteQuery()
}
任何人都可以解释我做错了吗?
我尝试$ web.AssociatedVisitorGroup,仍然不起作用 – ysfibm
你是什么意思?你得到错误,属性为空? – tinamou
它检索我:Microsoft.SharePoint.Client.Group – ysfibm