Tuesday, February 21, 2017

How to hide the App Store on SharePoint 2013 & 2016

After disabling the App Store in SharePoint (so our internal users couldn't download apps from the app store) the App Store icon still appeared on the left navigation; when clicked, and ugly message appeared.

"Sorry, apps are turned off.  If you know who runs the server, tell them to enable apps."

Well, this isn't very useful.  

After a call to Microsoft Support, I was instructed to hide the App Store instead.

Here are the steps to hide the App Store, which includes hiding the following:

  • SharePoint Store
  • Your Requests
  • Manage Licenses
  1. Make a backup of the AddAnApp.aspx file located in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\LAYOUTS
  2. Add the following to the AddAnApp.asxp file on ALL SHAREPOINT SERVERS IN THE FARM
    Search for

    ContentPlaceHolderId=
    "PlaceHolderAdditionalPageHead" runat="server">

    Then copy the following below and paste it under the previous line :

    <script
    language="javascript" type="text/javascript">
                
        window.addEventListener('load'function(){
                            
            function getAll(selector){
                                        
            return Array.prototype.slice.apply(document.querySelectorAll(selector));
                           
            }            
                           
            getAll('.ms-storefront-divider').forEach(function(divider){
                                        
                divider.style.display = 'none';
                            
            });                
                           
            getAll('a').forEach(function(link){
                                        
                if (link.innerHTML == 'Manage Licenses' || link.innerHTML == 'Your Requests' ||
                link.innerHTML == 'SharePoint Store' ) {
                                                   
                    link.style.display = 'none';
                                     
    }
                            
    });
                
    });
    </script>


  3. NOTE: If new servers are added to the farm, the AddAnApp.aspx file will need to be replaced with these changes
    NOTE: To show the SharePoint Store, Manage Licenses, and Your Requests, remove the code
  4. URL Hacking into the hidden areas: Since the hide is just textual, you can still get to the links by hitting the URL
    1. SharePoint Store: .... _layouts/15/storefront.aspx
    2. Your Requests: append to the addanapp.aspx url #mcg=4
    3. Manage Licenses: append to the addanapp.aspx url #mcg=3
  5. Disable "App State Update" Timer Job Go to Central Admin > Monitoring > Timer Jobs > Review Job Definitions and filter by Failed Jobs, you should see a failed Job for "App State Update". click on the job, then disable it.


Happy SharePointing :)
~ Kristin