Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Group can not be found - CSOM in Javascript

$
0
0

I am developing an app, and I am trying to test if a user is a member of a group. I have tested that the group can be seen in the settings of the sharepoint site - so the group definitely exists.

I have tried usnig cleint context and host context. But both result in an error "Group Can not be found".

My code in my Sharepoint Hosted App is as follows:

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var webContext = context.get_web();
var allGroups = webContext.get_siteGroups();
var mygroup = allGroups.getByName('my group');

$(document).ready(function () {
loadgroups();
}

function loadgroups(){
context.load(user);
context.load(allGroups);
context.load(mygroup);
context.executeQueryAsync(onSuccess, onFail);
}

*Error* groups can not be foudn


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>