none
Change Asset Picker Root Document Library RRS feed

  • Question

  • Hello,

    I wanted to change the root document library of the asset picker throught the whole site collection to be directed to "~site/SiteAssets". I wanted the left side menu to show only the /SiteAsset directory, not all subsites list. Can anyone direct me how to do that?

    According to this link here, this possible by modifying the AssetPortalBrowser.aspx and assetpicker.js files but does not state how.

    Could you please help

    Thanks in Advance


    • Edited by BruckG Friday, April 28, 2017 3:16 PM
    Friday, April 28, 2017 3:13 PM

Answers

  • Hi,

    We can hide the other menus using jQuery and CSS, check the steps below:

    1. Go to (C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS) find the AssetPortalBrowser.aspx file.

    2. Open the AssetPortalBrowser.aspx file and add the following code into the file.

    <style>
        #ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView table{
            display:none;
        }
    </style>
    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView table").each(function () {
            if($(this).find("a[title='Site Assets']").length>0){
                $(this).show();
            }            
        });
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Wednesday, May 3, 2017 9:26 AM
    • Unmarked as answer by BruckG Wednesday, May 3, 2017 9:26 AM
    • Proposed as answer by Dennis GuoModerator Thursday, May 4, 2017 7:58 AM
    • Marked as answer by BruckG Thursday, May 4, 2017 10:38 AM
    Monday, May 1, 2017 7:02 AM
    Moderator
  • WOW that did it, thank you Dennis.  You saved me a lot of time.
    • Marked as answer by BruckG Wednesday, May 3, 2017 9:27 AM
    Wednesday, May 3, 2017 9:27 AM
  • Hi,

    If my reply helps you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Thursday, May 4, 2017 10:38 AM
    Wednesday, May 3, 2017 9:30 AM
    Moderator
  • Hi,

    I modify the code as below for your reference:

    <style>
        #ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView>table{
           display:none; 
        }
    </style>
    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
            
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView > table").each(function () {
            if($(this).find("a[title='Site Assets']").length>0){
                $(this).show();
            }            
        });
        var currentContainerName = "Current Location: Site Pages at " + _spPageContextInfo.webAbsoluteUrl + "/SiteAssets";
        $("#ctl00_PlaceHolderDialogHeaderSection_PlaceHolderDialogDescription_currentContainerName").text(currentContainerName);
        var locationUrl = _spPageContextInfo.siteServerRelativeUrl + "/SiteAssets";
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyFooterMainSection_assetGoToLocationUrl_LocationUrl").val(locationUrl);
        
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Sunday, May 7, 2017 5:31 AM
    Friday, May 5, 2017 1:38 AM
    Moderator

All replies

  • Hi,

    We can hide the other menus using jQuery and CSS, check the steps below:

    1. Go to (C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS) find the AssetPortalBrowser.aspx file.

    2. Open the AssetPortalBrowser.aspx file and add the following code into the file.

    <style>
        #ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView table{
            display:none;
        }
    </style>
    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView table").each(function () {
            if($(this).find("a[title='Site Assets']").length>0){
                $(this).show();
            }            
        });
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Wednesday, May 3, 2017 9:26 AM
    • Unmarked as answer by BruckG Wednesday, May 3, 2017 9:26 AM
    • Proposed as answer by Dennis GuoModerator Thursday, May 4, 2017 7:58 AM
    • Marked as answer by BruckG Thursday, May 4, 2017 10:38 AM
    Monday, May 1, 2017 7:02 AM
    Moderator
  • WOW that did it, thank you Dennis.  You saved me a lot of time.
    • Marked as answer by BruckG Wednesday, May 3, 2017 9:27 AM
    Wednesday, May 3, 2017 9:27 AM
  • Hi,

    If my reply helps you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Thursday, May 4, 2017 10:38 AM
    Wednesday, May 3, 2017 9:30 AM
    Moderator
  • Hi Dennis,

    thank you for the answer. It really helped me a lot. I have already marked your replay as answered. I have two more questions though.

    1. how could I change the DefaultOpenLocationUrl location on the right side to go to the subsite's SiteAssets directory by default. Changing like DefaultOpenLocationUrl="~site/SiteAssets". Modifying DefaultOpenLocationUrl in assetpicker.js  did not help me. Maybe if its possible do it in AssetPortalBrowser.aspx

    2.  If I click on any folder under 'SiteAssets/' per your answer, the sidebar will be hidden since it does not have any Title by the name SiteAssets. could you help me to correct it if its any folder under 'SiteAssets' it will be shown but none above.

    Thank you in advance for your help

    Thursday, May 4, 2017 3:22 PM
  • Hi,

    I modify the code as below for your reference:

    <style>
        #ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView>table{
           display:none; 
        }
    </style>
    <script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
            
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyMainSection_TreeNav1_WebTreeView > table").each(function () {
            if($(this).find("a[title='Site Assets']").length>0){
                $(this).show();
            }            
        });
        var currentContainerName = "Current Location: Site Pages at " + _spPageContextInfo.webAbsoluteUrl + "/SiteAssets";
        $("#ctl00_PlaceHolderDialogHeaderSection_PlaceHolderDialogDescription_currentContainerName").text(currentContainerName);
        var locationUrl = _spPageContextInfo.siteServerRelativeUrl + "/SiteAssets";
        $("#ctl00_PlaceHolderDialogBodySection_PlaceHolderDialogBodyFooterMainSection_assetGoToLocationUrl_LocationUrl").val(locationUrl);
        
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by BruckG Sunday, May 7, 2017 5:31 AM
    Friday, May 5, 2017 1:38 AM
    Moderator
  • Hi Dennis,

    thank you for the quick replay.  Its currently listing all the directories under SiteAssets but with regards to my first question, when I go to other subsites and load the AssetPicker dialog it opens the last used location directory when it should have opened the SiteAssets directory under the current site.

    Meaning it loads http://sp2013/sites/team/SiteAssets directory in all subsites if I load the Asset Picker dialog box thoughout the site sitecollection per the link you gave on the example. But would it be possible if when I go throught different subsites, it loads the the current sub site's SiteAssets directory.

    Setting DefaultToLastUsedLocation="false" in assetpicker.js  did not do it.

    Thank you very much for the help

    Sunday, May 7, 2017 5:31 AM