1

I would like to know how can I set who can view the membership of a group to "everyone" by using powershell in sharepoint online? Many thanks in advance.

1 Answer 1

3

You can use the below code as a guide:

#Import the required DLL
Import-Module 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll'
#OR
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll'

#site URL
$site = 'https://Domain.sharepoint.com/'

#Admin User Principal Name
$admin = '[email protected]'

#Get Password as secure String
$password = Read-Host 'Enter Password' -AsSecureString

#Get the Client Context and Bind the Site Collection
$context = New-Object Microsoft.SharePoint.Client.ClientContext($site)

#Authenticate
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password)
$context.Credentials = $credentials

$web = $context.Web;
$grp = $web.SiteGroups.GetByName("name");
$context.Load($grp);
$grp.OnlyAllowMembersViewMembership = $false;
$grp.Update();
$context.ExecuteQuery();

Ref:https://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx

Ref:https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.group_members.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.