Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a new SharePoint group using UI.
I do not see the group using:

$web.Groups | select Name

Why? (I need to access to the group by CSOM but the group is not found)

share|improve this question

2 Answers 2

up vote 1 down vote accepted

There is no Groups property for Web client object

Use Web.SiteGroups property to get the collection of groups for the site collection, for example:

$web.SiteGroups | select Name  
share|improve this answer
var currentContext = new SP.ClientContext.get_current();
var currentWeb = currentContext.get_web();

var currentUser = currentContext.get_web().get_currentUser();
currentContext.load(currentUser);

var allGroups = currentWeb.get_siteGroups();
currentContext.load(allGroups);

var group = allGroups.getByName(groupName);
currentContext.load(group);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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