2

I was wondering if it's possible to alter a setting of a group such as Who can view the membership of the group?

Setting from Group Members to Everyone through CSOM or through SP's web services.

Right now I am creating a group using the AddGroup web service, but I can't seem to find any documentation on altering this setting. Any ideas?

for group creation I have followed below code

<script type="text/javascript">
    var siteUrl = '';
    function createListItem() {
    var getvalue = document.getElementById('<%=txtcategory.ClientID%>').value;
    var membersGRP = new SP.GroupCreationInformation();
    membersGRP.set_title(getvalue + '_Support_Group');
    membersGRP.set_description('desc');(membersGRP);
    oMembersGRP = currentWEB.get_siteGroups().add(membersGRP);
    clientContext.load(oMembersGRP);
    oMembersGRP = currentWEB.get_siteGroups().add   
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
</script>
2
  • It seems that part of your code is missing. Commented Oct 6, 2015 at 7:39
  • @Chakri : Your code looks incomplete. Also the way you have explained your question is not clear. I suggest you to rephrase it, in order to get more attention.
    – Asad Refai
    Commented Oct 6, 2015 at 8:53

1 Answer 1

3

You can change membership visibility via CSOM using set_onlyAllowMembersViewMembership function:

var context = SP.ClientContext.get_current()
var web = context.get_web()
var groups = web.get_siteGroups()
var info = new SP.GroupCreationInformation()
info.set_title('new_group')
var group = groups.add(info)
group.set_onlyAllowMembersViewMembership(false) //this line sets membership visibility
group.update()
context.executeQueryAsync(successHandler, errorHandler)
1
  • Thank u dstarkowski,its working fine
    – chakri
    Commented Oct 6, 2015 at 10:06

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.