Friday, 2 August 2013

SharePoint 2013 and the Noteworthy section

If you have added an App to a SharePoint 2013 site you will have seen the "Noteworthy" section which lists what appears to be favourites or well used items.  These Apps are by default Custom List, Document Library and Tasks but additional Apps can be included which are administered via the App settings in Central Administration.  SharePoint Apps are added into a normal SharePoint list and simply ticking the "Featured" property of the corresponding list item means it appears in the "Noteworthy" section (see http://office.microsoft.com/en-gb/sharepoint-help/use-the-app-catalog-to-make-custom-business-apps-available-for-your-sharepoint-online-environment-HA102772362.aspx).

However, if you think you can add something useful like a List Template - perhaps one created by your Users who do not want to page through all the available Apps in your farm - then you will be mistaken (unless someone knows better, which is very possible!). 

After doing some research, it does not appear to be possible to use a List Template in the "Noteworthy" section through the normal SharePoint UI and approaches open to normal users as it appears that this section is reserved for "real" Apps and not list templates and the like - therefore to appear in here it has to be an App (I'm willing to be challenged on this point, but I could not see a way to include a List Template in the "Noteworthy" section).

However, after doing some digging, it does appear to be possible to include an item like a List Template under the "Noteworthy" section but only by deploying some customisation which is not always a good thing. 

The page you navigate to when you want to add an App (AddAnApp.aspx) is generated mainly from JavaScript which makes several calls back into itself to get JSON in order to generate the Apps UI.  There are various JavaScript objects created in the page, most notably the "SP.Storefront" object which houses all of the App store front information.

To add an item to Noteworthy is simple enough once you get passed the obfuscation of objects and methods.  The SP.Storefront contains a StorefrontApp object which itself contains a method "get_currentView()".  This method gives me the Management View of the App store front.  This is the object that contains all the view information - what Apps are listed, categories and so on.  One of the properties of the Management View is $L_3 which is an array containing all the available Apps while the property $2i_3 is another array containing only the "Noteworthy" items.

Both of these arrays, $L_3 and £2i_3, contain a number of SPAppMetadata objects which themselves contain a property $2Q_0.  $2Q_0 gives us access to the JSON returned from AddAnApp.aspx for this particular App, so therefore includes more readable properties like ID, Title, Language and so on.  These can be used to identify the App you want to promote into the Noteworthy section, and once identified it's simply a case of adding the item from the $L_3 array into the $2i_3 array.

Of course, that's not the end of the story, adding the object into the array simply means the data is now available, but the UI doesn't update.  To force the UI to catch up, you need to also make a call to SP.Storefront.StorefrontApp.get_currentView().updateUI() and the animation you normally see runs making your new Noteworthy App available.

The obvious question is "how do I get the custom JavaScript into the page?".  Well, the AddAnApp.aspx page uses minimal.master.  Therefore, it's possible that you could add in a delegate control to run some JavaScript in order to update the UI - probably coding it to be specific to the AddAnApp.aspx page rather than running on every page.  You may also be able to use something like a Custom Action using the location of ScriptLink as in SharePoint 2010.

Hope this helps someone out there save some time as it took me a while to work it all out!  There are always better ways to do these things, so if you feel you want to you can let me know if you found another way that works as well.

1 comment:

  1. Nice digging. Was just doing the same. Have you actually ever seen the Noteworthy thing work out of the box? I can tick whatever app I want from my App Catalog as being "Featured", it never gets returned in the JSON thus never shows up under Noteworthy...

    ReplyDelete