Display List in Sub Site

So, I’ve been doing a bit of work on a 2007 environment lately so this solution is specifically for 2007 BUT I will provide a link to the 2010 script as well, so don’t worry.

Here is a bit of script that will let you display a list view on a sub site page. Paste it into a Content Editor web part but be sure to update the URL of the list view you want to display. Also, if you find you get an error, you can add ?contents=1 to your page URL and delete the CE web part if you need to.

The script comes from the following post: http://blog.pathtosharepoint.com/2009/01/22/a-simple-method-to-display-a-list-in-another-site/

and here is a jQuery adaptation that works well too: http://www.balestra.be/2012/04/want-to-display-a-sharepoint-list-from-another-site-collection-use-these-2-lines-of-jquery-script.html

<DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>
<!-- Paste the URL of the source list below: -->
<script type="text/javascript">
function DisplayThisList()
{
var placeholder = document.getElementById("ListPlaceholder");
var displaylist = null;
var sourcelist = document.getElementById("SourceList");
try {
   if(sourcelist.contentDocument)
      // Firefox, Opera
      {displaylist = sourcelist.contentDocument.getElementById("WebPartWPQ2") ;}
   else if(sourcelist.contentWindow)
      // Internet Explorer
      {displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ2") ;}
   else if(sourcelist.document)
      // Others?
      {displaylist = sourcelist.document.getElementById("WebPartWPQ2") ;}
}
catch(err) { alert ("Loading failed");}
displaylist.removeChild(displaylist.getElementsByTagName("table")[0]);
var allDescendants = displaylist.getElementsByTagName("*");
for (i=0;i<allDescendants.length;i++) {
allDescendants[i].removeAttribute("id");
allDescendants[i].removeAttribute("onclick");
allDescendants[i].removeAttribute("onfocus");
allDescendants[i].removeAttribute("onmouseover");
}
placeholder.innerHTML = displaylist.innerHTML;
}
</script>

 

Advertisements

One thought on “Display List in Sub Site

  1. Hey,
    could you provide the 2010 solution please. Have you managed to use group function in remote list web part?
    BR
    Antonio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s