Is it possible to organize the site contents page?
-
09-10-2020 - |
Question
When navigating to Settings > Site Contents you see a page, alphabetically displaying the lists, libraries and apps of that site.
Is it possible to group/organize these into logical groups? I cant find anything useful online. :(
OTHER TIPS
create custom property for each list/library:
A) add applicationPage with radio buttons like this:
code behinde:
get all groups
protected void Page_Load(object sender, EventArgs e) { //fill ddl SPList currentList = Web.Lists.GetList(new Guid(Request.QueryString.Get["list"],true)); string currentGroup = null; if(!currentList.Hidden) //lists in siteContent { List<string> groups = new List<string>(); foreach(SPList list in Web.Lists.OfType<SPList>().Where(a=> !a.Hidden)) { string myGroup = list.RootFolder.Properties["customGroup"].ToString(); if(!groups.Contains(myGroup) ) { groups.Add(myGroup) if(currentList.ID == list.ID) currentGroup = myGroup; } } } ddl.DataSource = groups; ddl.DataBind(); //set checked input new/exist ListItem item = ddl.Items.FindByValue(currentGroup ) if(item == null) ddl.Value = currentGroup; else inputNewGroup.Checked = true; }
save group
protected void ok_click(object sender, EventArgs e) { string currentGroup = null; if(inputNewGroup.Checked) currentGroup = txtNewGroup.Text; if(inputExistingGroup.Checked) currentGroup = ddl.Value; SPList currentList = Web.Lists.GetList(new Guid(Request.QueryString.Get["list"],true)); currentList.RootFolder.Properties["customGroup"] = currentGroup currentList.Update(); }
B) call page you created by customAction
<CustomAction Id="CustomAction" Title="Group" Sequence="0" Location="Microsoft.SahrePoint.ListEdit" GroupID="GeneralSettings"> <UrlAction Url="~sitecollection/_layouts/15/ChangeMyGroupList.aspx?List={ListId}" /> </CustomAction>
now the list settings page look like this:
2. display lists group by categories:
change the /_layouts/15/viewlsts.aspx (or copy and change the link in masterPage)
open the file from c:\program files\common files\microsoft shared\web server extensions\15\template\layouts
add code:
replace
foreach(... in rgApps)
, tostring currentListgroup= null; string group = null; bool isNewGroup = false; foreach(KeyValuuPair<string,object> entry in (from list in rgApps order by (list.Value as SPList).Title order by (list.Value as SPList).RootFolder.Properties["customGroup"] order by (list.Value as SPList).RootFolder.Properties.ContainsKey("customGroup") select list))
in the foreach block insert code:
if(entry.Value is SPList) { SPList list = (SPList)(entry.Value) currentListgroup = list.RootFolder.Properties["customGroup"].ToString(); isNewGroup = currentListgroup != group ; group = currentListgroup ; }
before the div with
id="apptitle-<%SPHttpUtility.WriteHtmlEncde(id...)%>"
insert new element<% if(isNewGroup ) { %> <div class="group"> <h2 class="ms-vl-sectionHeaderRow"><%= group%> </h2> </div> <% } %>
now site content look like this: