Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
授予“编辑”权限;“每个人”;在SharePoint列表中使用PowerShell客户端代码_Powershell_Sharepoint Online_Sharepoint List - Fatal编程技术网

授予“编辑”权限;“每个人”;在SharePoint列表中使用PowerShell客户端代码

授予“编辑”权限;“每个人”;在SharePoint列表中使用PowerShell客户端代码,powershell,sharepoint-online,sharepoint-list,Powershell,Sharepoint Online,Sharepoint List,我已使用PowerShell客户端代码在SharePoint网站中创建了一个列表。现在我想编辑此列表的权限。我想将此列表的编辑权限授予所有人。这就是我如何获得每个人详细信息的方法: $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $user =$Ctx.web.EnsureUser("c:0(.s|true") $Ctx.Load($user) $Ctx.ExecuteQuery() 为了打破列表的继

我已使用PowerShell客户端代码在SharePoint网站中创建了一个列表。现在我想编辑此列表的权限。我想将此列表的编辑权限授予
所有人
。这就是我如何获得
每个人
详细信息的方法:

$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$user  =$Ctx.web.EnsureUser("c:0(.s|true")
$Ctx.Load($user)
$Ctx.ExecuteQuery()
为了打破列表的继承性,我使用了以下方法:

$List = $Ctx.Web.Lists.GetByTitle("ListName")
$Ctx.Load($List)
$Ctx.ExecuteQuery()
$List.BreakRoleInheritance($true)

但我不确定如何将此列表的编辑权限授予
所有人
。任何建议都会有帮助。谢谢

以下是一个示例,介绍如何为每个列表的负责人授予
编辑
权限:

$roleDefinition = $ctx.Site.RootWeb.RoleDefinitions.GetByType([Microsoft.SharePoint.Client.RoleType]::Editor)  
$roleBindings = New-Object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx) 
$roleBindings.Add($roleDefinition)
$ctx.Load($list.RoleAssignments.Add($user, $roleBindings))
$ctx.ExecuteQuery()
先决条件


谢谢你的回答。这个有dll依赖关系吗?如果是,那么如何检查dll是否已加载?因为有时候,
$user
是空的。@HarshJaswal,有一个依赖项需要感谢您的帮助。