Hi,
I'm running the code below in a CEWP, on a Sharepoint site:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script> <script type="text/javascript"> $().ready(function () { var siteTitle = ""; var siteGroups = ""; var siteOwners = ""; var sitecount = ""; var groupName = ""; $().SPServices({ operation: "GetAllSubWebCollection", completefunc: function (xData, Status) { $("#WSOutput").append("<b>This is the output from the GetAllSubWebCollection operation:</b><br>"); $(xData.responseXML).find("Web").each(function() { siteTitle = $(this).attr("Title"); siteURL = $(this).attr("Url"); siteGroups = getGroups(siteURL); siteOwners = getGroupOwners(groupName); $("#WSOutput").append("Site Title: " + siteTitle + "<br>URL: <a href='" + siteURL + "'>" + siteURL + "</a>" + "<br>" + siteGroups + "<p>" + siteOwners + "<p> Count of groups: " + sitecount + "<hr/>"); }); } }); function getGroups(siteURL2) { var groupdata = ""; $().SPServices({ operation: "GetGroupCollectionFromWeb", webURL: siteURL2, async: false, completefunc: function (xData, Status) { var count = 1; $(xData.responseXML).find("Group").each(function() { groupdata = groupdata + "Group Name " + count + " : " + $(this).attr("Name") + "<br>"; count++; var matched = $(this).attr("Name").match("Owner"); if (matched == "Owner") { groupName = $(this).attr("Name"); } }); sitecount = count - 1; count = 1; } }); return groupdata; } // Get Display name based on user ID function GetDisplayName(userNo) { var userName = ""; var substr = ""; $().SPServices({ operation: "GetUserInfo", async: false, userLoginName: userNo, completefunc: function (xData, Status) { $(xData.responseXML).find("User").each(function() { userName = $(this).attr("Name"); substr = userName.split(',') userName = substr[1] + " " + substr[0]; }); } }); return userName; } function getGroupOwners(groupName) { var ownerdata = ""; // Gets users within Owners group $().SPServices({ operation: "GetUserCollectionFromGroup", groupName: groupName, async: false, completefunc: function (xData, Status) { $(xData.responseXML).find("User").each(function () { var displayName = GetDisplayName($(this).attr("LoginName")); ownerdata = ownerdata + "User ID: " + $(this).attr("LoginName") + " - Name: " + displayName + "<br>"; }); } }); return ownerdata; } }); </script> <div id="WSOutput"></div>
As site owner and Sharepoint master admin, I can see the results of the code perfectly - yet 2 of my colleagues, who are also master site admins (and of which one of them is owner on at least 2 subsites), can't see any results at all? All they see is this line: <b>This is the output from the GetAllSubWebCollection operation:</b>.
Any ideas anyone?