Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Site
- Document Library
- Pages
- Page 1
- Page 2
- SubSite
- $usrold =$web.SiteUsers.GetByLoginName($O365GroupOld)
- $ctx.Load($usrold)
- $ctx.ExecuteQuery()
- $web.SiteUsers.Remove($usrold)
- $ctx.ExecuteQuery()
- $usernew=$web.EnsureUser($O365GroupNew)
- $ctx.Load($usernew)
- $ctx.ExecuteQuery()
- $roleDefinition = $ctx.Site.RootWeb.RoleDefinitions.GetByType([Microsoft.SharePoint.Client.RoleType]::Contributor)
- $roleBindings = New-Object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx)
- $roleBindings.Add($roleDefinition)
- $ctx.Load($web.RoleAssignments.Add($usernew, $roleBindings))
- $ctx.ExecuteQuery()
Add Comment
Please, Sign In to add comment