Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Customise /_layouts/15/Groups.aspx ??

$
0
0

Hi All,

Is there a way to modify the out-of-the-box behaviour of /_layouts/15/groups.aspx so that ONLY those groups which have permissions in thecurrent site are displayed - rather than all groups in the site collection?

I've written a custom application page to deploy my own *version* of the page to the _layouts folder with something along these lines :-

 protected void Page_Load(object sender, EventArgs e)
        {
            using (SPWeb oWebsite = SPContext.Current.Web)
            {
                spnNew.InnerHtml = "<a href=" + oWebsite.Url + "/_layouts/15/newgrp.aspx>New...</a>";
                spPeopleandGroups.InnerText = oWebsite.Title + " - People and Groups";
                lstSiteGroups.InnerHtml = "<hr>";
                lstSiteGroups.InnerHtml = lstSiteGroups.InnerHtml + "<table cellpadding=0 cellspacing=0 width=100% border=0><tr><td>Group</td><td>Edit</td><td>About Me</td></tr>";
                SPGroupCollection collGroups = oWebsite.Groups;
                foreach (SPGroup oGroup in collGroups)
                {
                    lstSiteGroups.InnerHtml = lstSiteGroups.InnerHtml + "<tr><td><a href=" + oWebsite.Url + "/_layouts/userdisp.aspx?ID=" + oGroup.ID + ">" + SPEncode.HtmlEncode(oGroup.Name) + "</a></td><td><a href=" + oWebsite.Url + "/_layouts/useredit.aspx?ID=" + oGroup.ID + "><img border=0 src=/_layouts/15/images/edititem.gif?rev=23></a></td><td>" + SPEncode.HtmlEncode(oGroup.Description) + "</td></tr>";
                }
                lstSiteGroups.InnerHtml = lstSiteGroups.InnerHtml + "</table>";
            }
        }

where lstSiteGroups / spnNew and spPeopleandGroups are runat server span tags ..... but clearly, this seems like overkill for what should be simple behaviour....

Also - because the links to the edit and view groups in my code take the user to the default pages - we then lose track of my custom page.

Can the groups.aspx page be limited to just displaying those in spcontext.current.web.Groups ??

Thanks

Steve


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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