The objective is to have a landing page where every user can see what team sites exist and who to contact to request access (which is either someone who has full control to the site or someone who is in an office 365 owners group attached to the site).

Does anyone know a straight forward way of doing this that would list all the sites in the site collection with full control users in a list to display on the home page?

Thanks, Clare

1 Answer 1


We can use jQuery and REST API to get subsites base on current user permission. Add the code below into a script editor web part into home page.

<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function () {
    }, "sp.js");
function IsAdminUser() {
    var isAdmin=false;
    //Permission for admin to show or hide the entries on memory board using ShowOnHomePage Field
    var perm = new SP.BasePermissions();
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/doesuserhavepermissions(@v)?@v={'High':'" + perm.$E_1.toString() + "', 'Low':'" + perm.$D_1.toString() + "'}",
        type: "GET",
        headers: { "accept": "application/json;odata=verbose" },
        success: function (data) {
            var d = data.d.DoesUserHavePermissions;
        error: function (err) {
    return isAdmin;
function GetAllSubSites(){
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/GetSubwebsFilteredForCurrentUser(nWebTemplateFilter=-1)?$filter=WebTemplate ne 'APP'",  
        method: "GET",
        headers: {  
            "Accept": "application/json; odata=verbose"  
        success: function(data) {  
            var subSites = data.d.results;          
            var tempValue = "<h2>Sub sites</h2><br/>";  
            subSites.forEach(function(site) {  
                tempValue += "<p><a href='"+site.ServerRelativeUrl+"'>"+site.Title+"</a></p>";  
        error: function(data) {  
<div id="AllSubSites"/>

enter image description here

  • Hi, Thanks for the code however I need to get a list of all the site collections subsites and any users (not just current) that has full control permission to the and any users who have full control that are in office 365 groups. eg Team Site Title Owners (not the official owners of the URL - just the users who have full control on the site
    – clare
    Aug 23, 2018 at 2:17
  • In the code above, it works for all the users who have full control permission in the site collection, if the user not have permission, it will not see the this web part content.
    – LZ_MSFT
    Aug 23, 2018 at 8:49
  • Hi, thanks for replying. That's the issue - all users (no matter what permission level) need to see this list. It's a list to display all the url's and all the people who have full control access (including office 365 groups) so the user can then contact these people to request access. It needs to be two columns - one for the site title and one for displaying any users who has full control access to the site. It's basically just looking up info to display.
    – clare
    Aug 24, 2018 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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