2

How can I display the same Document Library, that already exists in a Subsite A, in another Subsite B ?
I want to display a Document Library with all the columns (Title, Modified By ...) and not links to the original document library.
I already tried Content Query Webpart but it displays a list of Links to the original Document Library.

PS : I want to put the same documents in too different subsites without duplicating the files. I want to save the files in Subsite A, create a Document Library there and then create the same Document Library in Subsite B without copying the files.

2
  • You can save the list as template in SiteA and restore it in SiteB. Is that what you are looking for? Oct 20, 2014 at 13:24
  • Not really. I edited my post to be more clear.
    – Mehdi
    Oct 20, 2014 at 13:30

2 Answers 2

3

You can't easily. You can try:

  • Page Viewer Web Part, and just consume the library from Subsite A. When setting up the URL to the page, include IsDlg=1 at the end, that'll hide the ribbon and stuff: http://davidlozzi.com/2014/03/25/we-all-know-what-sharepoint-isdlg-does-wait-what-the/
  • Custom web part which pulls and reads the library, but you would have to recreate almost all the functionality around a library's UI (terrible idea)
  • Use CQWP as you tried before, and live with the links ;) it's all in SharePoint anyway.

Using the first option, you could embed this on your page, ensure you have jQuery in there:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("hideItAll");

function hideItAll(){
    if(window.location.search.toLowerCase().indexOf("isdlg=1") > 0){
        $("#s4-ribbonrow").hide(); //ribbon bar

        //because the bar joins us late in the game, we need to throw CSS in to hide it
        $("head").append("<style>#Hero-WPQ2 { display:none }</style>");

        $("#CSRListViewControlDivWPQ2").hide(); //views and search bar
    }
}
</script>

Not sure how much you want to hide here, so i put it all in, remove what you'd like. Also you may have to check the second two IDs, that end in WPQ2, yours may be WPQ1 or 3? If you need help, you can use your dev toolbar to find your IDs, more help here: http://davidlozzi.com/2013/05/08/a-non-developers-intro-to-the-developer-toolbar-element-inspection/

25
  • I don't at this point, havent had much exposure to variations. Sorry Oct 20, 2014 at 13:35
  • With the IsDlg=1 it shows the "VARIATIONS / FILES / LIBRARY" Tab ... Do know how to hide this tab too ?
    – Mehdi
    Oct 22, 2014 at 8:36
  • Some custom JS and CSS on the target page can help, not sure if that's possible? Oct 22, 2014 at 12:51
  • Sure, I just thought I was missing a feature ... But apparently it is not possible without some custom code ... I say let's play ! :)
    – Mehdi
    Oct 22, 2014 at 13:29
  • added code to post Oct 23, 2014 at 12:53
2

This worked for me in SharePoint 2016.

This is for displaying a webpart, target in some other site in the collection.

  1. In SharePoint Designer, open target's view's page (AllItems.aspx, for example)
  2. Find <ExportControlledProperties>False</ExportControlledProperties>, change it to True. Save the page.
  3. In your browser, navigate to target's page. Click Site Actions -> Edit Page.
  4. Click the arrow on the top right of the webpart -> Export.
  5. Save the file somewhere.

Now, in SP2016, importing this webpart as-is gave me an error. To fix it:

  1. Find the GUID of the site that owns target.

    1. In target's site, go to the Site Settings
    2. Enable Tree View (temporarily, you can disable once we're done)
    3. Go to the site's main page. View the page's source.
    4. Find ListNode:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:XXX...
    5. Copy the first GUID (before the first colon). That's the site's GUID.
  2. Open target.webpart that you saved in step 5 in a text editor.

  3. Find <property name="WebId" ... >00000000-0000-0000-0000-000000000000</property>
  4. Replace the zeroes with the site's GUID from step 6. Save the file.
  5. Upload target.webpart in the Insert Webpart menu.

Sources:

http://techtrainingnotes.blogspot.com/2009/03/sharepoint-one-library-multiple-sites.html http://techtrainingnotes.blogspot.com/2012/02/sharepoint-finding-site-guid-sharepoint.html

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.