1

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>
  • It seems that part of your code is missing. – dstarkowski Oct 6 '15 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 Oct 6 '15 at 8:53
2

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)
  • Thank u dstarkowski,its working fine – chakri Oct 6 '15 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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