Below is my code:
var clientContext = SP.ClientContext.get_current();
// Fetch all groups because I can't just grab those for this subsite.
this.collGroup = clientContext.get_web().get_siteGroups();
var SvcUnit = 'AJM';
clientContext.load(collGroup);
clientContext.load(collGroup, 'Include(Users)');
collGroup = clientContext.get_web().get_siteGroups();
clientContext.load(collGroup);
clientContext.load(collGroup, 'Include(Users)');
clientContext.executeQueryAsync(Function.createDelegate(this, function() {
var groupsInfo = '';
var groupsEnumerator = collGroup.getEnumerator();
while (groupsEnumerator.moveNext()) {
var oGroup = groupsEnumerator.get_current();
// alert(oGroup.get_title());
if (oGroup.get_title().indexOf('Front Office') != -1) {
var mygrpsvcunit = (oGroup.get_title());
if (oGroup.get_title().indexOf(SvcUnit) != -1) {
// alert(oGroup.get_title());
FrontOfficeGrpId = oGroup.get_id();
FrontOfficeGroupName = oGroup.get_title();
// alert(FrontOfficeGrpId);
// alert(oGroup.get_title());
// alert('Front office group is: ');
// alert(FrontOfficeGroupName);
// alert(FrontOfficeGrpId);
timeout(5000).then(function() {
retrieveAllUsersInFrontOffice(FrontOfficeGrpId);
});
}
The problem is, in my SharePoint site I do have a permission group whose name consists of AJM and Front Office. However, I am not able to retrieve it vis indexOf.
Any idea if I can use another method of finding it? I can find other groups using IndexOf method only not this one.
Thanks
faye fouladi