0

We're in the process of migrating to SharePoint Online from SharePoint 2007. It's become painfully clear that the way we architected our environment is not really jibing with SharePoint Online. We have a site collection that has almost 2000 subsites and it's uncovered some serious performance issues. As I understand it, my options for navigation are as follows (preference is bolded)--

  • Structured Navigation -- painfully slow, not really an option. 57 second load time!
  • Manually updated list of sites on the parent page -- please don't make me do this. It's bound to get out of sync and users will not be able to find the sites.
  • Search-based web part -- this seems like an option, but I can't come up with anything that looks nice and it seems to have some irritating limitations like no more than 50 results per page.
  • Somehow recreate the list that exists on the Site Contents (viewlists.aspx) page on my parent landing page. This list looks perfect and I'd love it if I could recreate it as is, but the problem is I have no idea how to do that. I'm also failing to understand why this would load so snappy but Structured Navigation would load so slowly -- seems like they're doing the same thing.

Can anyone help me out with this?


Update: So I've decided to create an "app part" using the Javascript object model and I'm actually making some pretty good headway. At the moment I've got the collection of subwebs loaded into a var called webCollection and I've got them displaying as options in a box. The only reason they ended up there is because that was the sample code that I had to work with :) I'd ideally like them in a nicer looking list, similar to the viewlists.aspx page with clickable links. Can someone help me figure out modify my existing code? Here are the relevant bits --

SubsiteListAppPart.js

function GetSubwebsToDisplaySuccess(sender, args) {
    // Success getting the subwebs. Set references to the subweb
    // elements and the list of available subwebs.
    var subwebEnumerator = webCollection.getEnumerator();
    var selectSubwebBox = document.getElementById("listItemSubwebBox");
    if (selectSubwebBox.hasChildNodes()) {
        while (selectSubwebBox.childNodes.length >= 1) {
            selectSubwebBox.removeChild(selectSubwebBox.firstChild);
        }
    }
    // Traverse the elements of the collection, and load the name of
    // each list into the dropdown list box.
    while (subwebEnumerator.moveNext()) {
        var selectOption = document.createElement("option");
        selectOption.value = subwebEnumerator.get_current().get_title();
        selectOption.innerText = subwebEnumerator.get_current().get_title();
        selectSubwebBox.appendChild(selectOption);
    }
}

SubsiteListAppPart.aspx

<body>
    <select id="listItemSubwebBox"></select>
</body>

LATEST UPDATE: I'm now at the point where I have a <table> of <a> elements of all my subsites! The last piece I'm struggling with is the default sizing of the app part iFrame. I need to autosize to the height/width of the table, but can't figure out how to do so. I may start a new question for this.

1 Answer 1

1

All viewlists.aspx does is calls this code:

    <%
SPWebCollection webs = Web.GetSubwebsForCurrentUser();
if (!HasNonAppSubwebs(webs))
{
    %>
        <tr><td colspan="4" class="ms-textLarge"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,allapps_nosubsites%>" EncodeMethod='HtmlEncodeAllowSimpleTextFormatting'/></td></tr>
    <%
}
foreach (SPWeb webToDisplay in webs)
{
    if (webToDisplay.IsAppWeb)
    {
        webToDisplay.Dispose();
        continue;
    }
    string imageUrl;
    string toolTip;
    string webId;
    Pair webImageData = SPUtility.MapWebToIcon(webToDisplay);
    imageUrl = (string)(webImageData.First);
    toolTip = SPHttpUtility.HtmlEncode((string)(webImageData.Second));
    string destUrl = SPHttpUtility.UrlPathEncode(webToDisplay.Url + "/",true);
    string webLinkId = "webUrl-" + webToDisplay.ID.ToString();
    if (draggableContentIds.Length > 1)
        draggableContentIds += ",";
    draggableContentIds += "\"" + webLinkId + "\"";
%>

You can create a Visual SandBox WebPart, and add it to your parent landing page. Which will display same list.

4
  • Thanks a ton. I'll see if I can figure this out tomorrow. Any theories as to why this would be so much faster than allowing Structured Navigation to load the subsites list? I'm afraid that when I finally do get this webpart built that it too will be slow and I'll really just be out of luck.
    – pk01
    Commented Jun 3, 2015 at 21:37
  • I'll gladly can make a solution and post it here. Let me know if need it.
    – dotsa
    Commented Jun 3, 2015 at 21:49
  • It'd be nice for sure. I'm spinning up an instance of SharePoint Foundation in Azure to start building out my development environment. I suppose if you build it, I'd love to see the full solution file so that I can learn the ins and outs of a basic Visual Sandbox WebPart. I'm also researching the whole Napa Cloud App route, but I'm not sure how to convert what you've posted here into that style project. I guess it's all .js?
    – pk01
    Commented Jun 3, 2015 at 22:02
  • I can't decide if the struggles I've had getting the results of Web.GetSubwebsForCurrentUser() to show up in a SharePoint App Part are funny or sad. I'm not a web developer, so obviously I can expect somewhat of a learning curve, but the stuff I'm running into seems sort of ridiculous.
    – pk01
    Commented Jun 4, 2015 at 16:34

Your Answer

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

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