TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get SharePoint Site Groups using JSOM
Shantha Kumar T
Feb 22
2016
Code
2.5
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
function
getsiteGroups() {
var
clientContext = SP.ClientContext.get_current();
oGroups = clientContext.get_web().get_siteGroups();
clientContext.load(oGroups);
clientContext.executeQueryAsync(
Function.createDelegate(
this
,
function
(){
var
groupsInfo =
''
;
var
groupsEnumerator = oGroups.getEnumerator();
while
(groupsEnumerator.moveNext()) {
var
oGroup= groupsEnumerator.get_current();
groupsInfo +=
'\n'
+
'Group ID: '
+oGroup.get_id() +
', '
+
'Title : '
+ oGroup.get_title(); }
console.log(groupsInfo.toString());
}),
Function.createDelegate(
this
,
function
(){console.log(
'failed'
);}));
}
function
injectMethod(){
getsiteGroups();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod,
"sp.js"
);
Code snippet works in Office 365 and SharePoint 2013 +
SharePoint
JSOM
SIteGroups