none
Sharepoint Group Settings

    Question

  • Our organization has about 200 Sharepoint Groups in MOSS 2007. Currently the Group Settings for each group is set to only allow Group Members to see who has membership to the group. We have been asked to change this to allow everyone to view group membership. I really do not want to have to visit each group to change the setting manually and was wondering if there was a way to do this programically through a script. If anyone could point me in the right direction I would appreciate it. Thanks.

    Moss 2007 with Server 2008R2

    Kim

    Thursday, March 15, 2012 1:51 PM

Answers

  • Hi Kim,

    Here's the code snippet that you could use -

    SPSite site = new SPSite("http://abc:xxxx/ReferenceMaterials/");
    SPWeb currentWeb = site.AllWebs[0];
    SPGroup grp = currentWeb.Groups["GroupName"];
    grp.OnlyAllowMembersViewMembership = false;
    grp.Update();

    Please let me know if you require further details.


    Thanks, Suneetha

    Thursday, March 15, 2012 5:59 PM

All replies

  • The OnlyAllowMembersViewMembership property of the SPGroup class (SPGroup.OnlyAllowMembersViewMembership) is responsible for this behavior. Setting OnlyAllowMembersViewMembership to true allows only the group members see the membership, which is how you currently have the groups configured. Setting it to false allows anyone to see membership, which is what you want.

    You would want to grab all of the groups in the web and then change this property for each group. Unfortunately, I don't have a code solution for you as I don't have a WSS or MOSS farm with PowerShell to test on.


    Jason Warren
    Infrastructure Specialist
    Habañero Consulting Group
    www.habaneros.com/blog



    Thursday, March 15, 2012 3:56 PM
  • Hi Kim,

    Here's the code snippet that you could use -

    SPSite site = new SPSite("http://abc:xxxx/ReferenceMaterials/");
    SPWeb currentWeb = site.AllWebs[0];
    SPGroup grp = currentWeb.Groups["GroupName"];
    grp.OnlyAllowMembersViewMembership = false;
    grp.Update();

    Please let me know if you require further details.


    Thanks, Suneetha

    Thursday, March 15, 2012 5:59 PM