Cross-Site List Snapshot, version 2.0 beta

Last year I published a simple method to display a SharePoint list in another site. I am releasing today version 2.0 beta of the jQuery script:
[09/15/2010: link updated to the new Toolkit location]

I have renamed it “snapshot”, to better reflect its (limited) capabilities. The snapshot created on another site doesn’t have all the features of the original view, for example context menus or expand/collapse buttons will not work. But at least this allows you to view the list items, and preserves the hyperlinks.

The main improvements in version 2:
– the script now works for both lists and calendars
– there won’t be any conflict if you place several scripts on the same page
– a form helps you select your options, and includes a debugging utility

How to get the script?
Fill out the form, and click on the “Save to Disk” button. Once you have your script, you can add it to a SharePoint page via a Content Editor Web Part (preferred solution: upload the text file containing the script to a SharePoint library, then link to it from the CEWP).

– if you don’t have Flash 10 installed, you won’t see the “Save to Disk” button. In this case, just copy and paste the code displayed in the text area.
– the target Web page needs to be on the same domain as the original view. If the view is on, you can display a snapshot on any page that belongs to, but not on for example.
– keep in mind that it is a beta version, for evaluation purposes.

 To report an issue, leave a comment below, or send an e-mail to

Why this script?
SharePoint doesn’t offer a convenient way to display information from a site in another site. This script gives you a workaround to accomplish this.
Other solutions:
– the Page Viewer Web Part (but doesn’t give a clean layout)
– Data View Web Part and Content Query Web Part (for advanced users, and only work within the same site collection)
– Web services and URL protocol (also for advanced users, and only work in authenticated environments)
– RSS feeds (requires you to rebuild the view on the target page)

Where can I find instructions?
The page is still under construction. For now, see last year’s article, and the context help available on the form. I’ll publish a tutorial later this month.

83 thoughts on “Cross-Site List Snapshot, version 2.0 beta

    • Robin: I haven’t tried your solution, but I expect it to be definitely cleaner than the raw PVWP. I have also done something similar where I used jQuery to resize the PVWP to the size of the list view (and then resize it dynamically if the user navigates to another page within the PVWP). I would also be interested in reading Baris Wanschers’ post, but the link was broken.

      With such a method, you force the size of the PVWP, and then the page adjusts itself around the PVWP. With the method I describe in the post, the view becomes part of the page. Well, I guess both have their place…

  1. Great tool and thanks!

    Only problems is I get the “! error on page” Error: Expected “;”

  2. I found the problem.

    I was using 1.3.2 Jquery instead of 1.4.2.

    Sorry for the trouble

    Thanks again.

  3. Hi Christophe, this is great! We have a limited SP dev env & I’ve been researching multiple alternatives the past several days. This is exactly what I needed & it will help me move forward!

    Thank you

  4. Thank you Christophe, this is great! Just what I wish the content query WP could do.

    One note to others is that the external list has to be in standard view, not datasheet, to work.

  5. Pingback: A simple method to display a list in another site « Path to SharePoint

  6. Pingback: Most Tweeted Articles by Sharepoint Experts

  7. This is brilliant, using the first version was good but tricky amending all the 1’s to 2’s etc if using it more than once on the same page but this version is much better and I will be letting evryone in my organisation know about this so they can use it on their sites.

    I do have an issue which someone might be able to answer (sorry could see where to add a new topic)

    On any list, if I change the view to Data View SharePoint crashes. No one else in my organisation seems to have this issue.

    Has anyone else seen this?



  8. I tried using this with “https” site and it didn’t work for me. I only saw the wheel spinning. it did not give me any error message.

    • Girish, could you confirm that both the current page and the source page have https? And did you include the debugging option in the script?

  9. Thanks for your hard work. I use this to display recent updates to a company message board on a different site. This worked far better than any SharePoint webparts I could customize.
    One thing I would like to do is be able to display a button if there are recent items, and not display it if there aren’t. I guess this just comes from lack of any real Javascript knowledge (C and C++ are my thing), but what kind of information is this JQuery returning? Can I do like an if(empty) sort of thing on the information that gets returned when it queries my Recent Items view, or would I have to think of a different way around this than your tool. Thanks in advance.

  10. Christophe – I am loving this!!

    Works great for me, even with https sites!! I was able to take bits of information across a site we subscribe to (with the site owner’s permission of course!) and whittle it down to what our team needs to see. Even works when I apply filters, sorts, etc, then bring back the huge URL!!

    One question – a couple of the lists and calendars I am returning to my site with this tool have calculated columns for rendering colors, email links, etc.

    I have tried adding one of your text to html web parts below the cross-site list web part, but all I see is the html.

    Is there anyway to have the cross-site list render properly? Is there code I can plop into the middle of it! Haha!

      • Christophe,

        I have the same problem as Bill and not being much of a programmer cannot follow your suggestion about the callback function. Is this somewhere within the Cross-Site List Snapshot code itself and if so could you or someone identify it for me. I would be most grateful.

  11. Thanks for the script, it’s great!

    We are using this across two different domains and have found that MOSS uses the current domain’s URL to create the individual link hrefs, which means the links generated by your script break in this situation. I fixed it with a couple regexes:

    Inside LoadView():
    var listRoot = ViewURL.replace(/^((?:https?:\/\/)?[^\/]*).*$/, ‘$1’);

    Inside the link-rewriting function:
    c.find(“a”).each(function() {
    var s=($(this).attr(“href”).indexOf(“?”)>0)
    ? “&”

    $(this).attr(“href”, listRoot + $(this).attr(“href”).replace(/^https?:\/\/[^\/]+/i,”) + s + “Source=” + location.href);

    I’m sorry about the variable names, but I was working off the compressed version.

      • Hmm, no idea about that one (I didn’t need to do anything special to get it to work). It is actually two different subdomains on the same domain. I, too, am working in a very limited SP environment, plus I’m new to SharePoint 😉

  12. Hi Christophe,

    This is brilliant. It has been a week I was trying to find a solution for my cross domain scenario.
    Your script is working great for cross domains (https).
    The only problem is the links, I get “The webpage cannot be found” error after clicking on the links in the list. I think the redirect is the problem.

    In my case:
    the URL of the item in domain 1 (Original list) is:

    The URL of the page with CEWP is:

    The URL of the above item after clicking it on CEWP is:

    Can you please help.

    Thanks 🙂

  13. Thank you Cameron for your reply. I am not very familiar with JavaScript. Tried to change the code based on your comment but the webpart is not working anymore. Will you please let me know where the problem is:

    if(typeof jQuery==”undefined”){var jQsrc=””;document.write(unescape(“%3Cscript src='”+jQsrc+”‘ type=’text/javascript’%3E%3C/script%3E”));}

    (function(){var ViewURL=””,sec=0;$.ajaxSetup({cache:false});var c=$(“#ListSnapshot”);c.removeAttr(“id”);var listRoot=ViewURL.replace(/^((?:https?:\/\/)?[^\/]*).*$/,’$1’);var LoadView=function(url){c.load(url+” #WebPartWPQ2 .ms-listviewtable”,function(){c.find(“.ms-viewheadertr th td”).each(function(){$(this).html($(this).text());});c.find(“*”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);c.find(“a”).each(function(){var s=($(this).attr(“href”).indexOf(“?”)>0)?”&”:”?”;$(this).attr(“href”,$(this).attr(“href”).indexOf(“?”).replace(/^https?:\/\/[^\/]+/i,”)+s+”Source=”+location.href);});});};LoadView(ViewURL);if (sec>0) {setInterval(function(){LoadView(ViewURL);},sec*1000);}})();

    Many Thanks.

    • Here’s a version that should work for you. Note that you must replace the curly quotes (both double and single) with regular ones for this to work.

      (function() {
      	var ViewURL="",
      	var c=$("#ListSnapshot");
      	var listRoot=ViewURL.replace(/^((?:https?:\/\/)?[^\/]*).*$/,'$1');
      	var LoadView=function(url) {
      		c.load(url+" #WebPartWPQ2 .ms-listviewtable",function() {
      			c.find(".ms-viewheadertr th td").each(function() {
      			c.find("a").each(function() {
      				var s=($(this).attr("href").indexOf("?")>0)?"&":"?";
      				$(this).attr("href", listRoot + $(this).attr("href").replace(/^https?:\/\/[^\/]+/i,"") + s + "Source=" + location.href);
      	if (sec>0) {
      • Thank you so very much Cameron.
        This was a big help. My final code which worked perferctly is a little different though. But I could not get there without your help.

        if(typeof jQuery==”undefined”){var jQsrc=””;document.write(unescape(“%3Cscript src='”+jQsrc+”‘ type=’text/javascript’%3E%3C/script%3E”));}

        /* Cross-Site List Snapshot – v 2.0 beta * Copyright (c) 2009-2010 Christophe Humbert * */
        (function(){var ViewURL=””,sec=300;$.ajaxSetup({cache:false});var c=$(“#ListSnapshot”);c.removeAttr(“id”);var listRoot=ViewURL.replace(/^((?:https?:\/\/)?[^\/]*).*$/,’$1′);var LoadView=function(url){c.load(url+” #WebPartWPQ2 .ms-listviewtable”,function(){c.find(“.ms-viewheadertr th td”).each(function(){$(this).html($(this).text());});c.find(“*”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);c.find(“a”).each(function() {
        var s=($(this).attr(“href”).indexOf(“?”)>0)?”&”:”?”;

        $(this).attr(“href”, listRoot + $(this).attr(“href”).replace(/^https?:\/\/[^\/]+/i,””) );});});};LoadView(ViewURL);if (sec>0) {setInterval(function(){LoadView(ViewURL);},sec*1000);}})();

        • Cameron and Roxy, could you precise in which browser(s) you made this work, and if you used specific settings (e.g. trusted sites)? I am concerned that other people may want to try your script but will fail because they don’t have the appropriate settings.
          For example, does it work in Firefox?

        • @Christophe:

          Can’t reply more than three levels deep, sorry. We are using IE7 here. I have not changed any options in it, and it also works in other people’s IE7 browsers. Unfortunately, I don’t have FF with me, but it does not work in Google Chrome (I get an internal error: “Failed to handle debugger reponse:
          SyntaxError: Unexpected token )” when viewing the page load in the Developer Tools window). I’m not sure Chrome is a supported browser in the first place, though.

          I do not know which settings are required for this to work; it is indeed interesting (I was thinking about your earlier comment, and you’re right, it shouldn’t work out of the box cross-domain, because that would be a security risk opening the way to CSRF attacks).

          Both Roxy and I are using this script across sub-domains of the same domain (I think that might make a difference, as opposed to two completely different domains — we are at least in the same tree), and obviously we have permission to view both sites.

          I don’t know what kind of trusts are in place here (I’m in a very large organization, and I don’t have permission to access administrator stuff).

  14. Hi
    I am trying cross-domain and just get the wheel spinning.


    Page to display list: http://dundrspt01:3537/ITTST/default.aspx


    if(typeof jQuery==”undefined”){var jQsrc=””;document.write(unescape(“%3Cscript src='”+jQsrc+”‘ type=’text/javascript’%3E%3C/script%3E”));}

    /* Cross-Site List Snapshot – v 2.0 beta * Copyright (c) 2009-2010 Christophe Humbert * */
    (function(){var ViewURL=””,sec=0;$.ajaxSetup({cache:false});var c=$(“#ListSnapshot”);c.removeAttr(“id”);var listRoot = ViewURL.replace(/^((?:https?:\/\/)?[^\/]*).*$/,’$1′);var LoadView=function(url){c.load(url+” #WebPartWPQ1 .ms-listviewtable”,function(){c.find(“.ms-viewheadertr th td”).each(function(){$(this).html($(this).text());});c.find(“*”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);c.find(“a”).each(function(){var s=($(this).attr(“href”).indexOf(“?”)>0)?”&”:”?”;$(this).attr(“href”,$(this).attr(“href”).indexOf(“?”).replace(/^https?:\/\/[^\/]+/i,”)+s+”Source=”+location.href);});});};LoadView(ViewURL);if (sec>0) {setInterval(function(){LoadView(ViewURL);},sec*1000);}})();

    What am I dong wrong? Please help…

    • Ben, see the notes at the end of my post. Browsers apply the “same domain policy”, and don’t allow cross-domain interaction. Cross-subdomain interaction is not allowed either.

      There’s a workaround in Internet Explorer (see above thread with Roxy, Cameron and me), but be warned that tagging a domain as trusted opens security holes.

      • Thanks Cristophe – both sites are already “trusted” which is why I thought there may be an error in my code.

        any further help would be much appreciated


  15. greetings
    i’m so happy that i found this article. that topic was so nice. thanks again i bookmarked this page.
    are you planning to write similar posts?

  16. Great work.
    This worked out for me.I had try your both the scripts in the article.
    “A simple method to display a list in another site” but doesn’t work out for me.
    This script work for me that’s strange. i bookmarked you on my one of favorite SharePoint blog.
    I appreciate your help to the share-point end users.
    Thanks a lot and hope you share your knowledge to the sharepoint enduser community.

  17. Is there a possibility to see a screen shot of the merged calendars? I already tried another method, and after a few hours, found it wasn’t what I was looking for, so I want to make sure this is what I am looking for. Basically my intent is to take items on several calendars and combine them onto a master calendar. Thanks.

      • Christophe, even that would be better then what I got so far, which was just a list that displayed rows of entries, and not very cleanly. Thanks.

  18. Hi Christophe,

    My calendar items are shown with three vertical lines before the event title, for example: Event Category|||Title. How can I change the code so it only displays the title? Thanks!

  19. hey Christophe,

    Always following your work. I have been playing with this one today and I am trying to make the URL dynamic. Like off a click event. Then on a page I can call this script once and load different view into it. I am not really sure how to pass the the var into your script.

    Can I take this
    var ViewURL=”/link to listview.aspx”,sec=43200;$.ajaxSetup({cache:false});
    and do something like this
    var ViewURL=”+ newURL +”,sec=43200;$.ajaxSetup({cache:false});

  20. This is really awesome but I’m trying to display a calendar which has color added using your other great article.

    Is there a way to render the colors and have this calendar displayed on another site?

  21. Hello,
    As always, great tool!

    I was able to make the list snapshot snippet working with TextToHTML (calculated columns) snippet. Rather than cluttering the comment section, I have published my solution in my blog page (so I can easily modify it in case of error :P)
    Any comments appreciated.

  22. Pingback: A2life » Showing a list from another SharePoint Site

  23. Christophe, beautiful script! Any advice for those of us using server name with ports?

    The list I wish to “broadcast” is at http://n85shrpt:2002/dept/HR/Lists/Announcements/Current.aspx

    The home pages where I wish to display the snapshot are at
    where XXXX is 2002 through 2009.

    The list renders nicely on all home pages, but the links are broken on all but the home page sharing the same port, namely http://n85shrpt:2002/

    Is there a way I can make the links work for the snapshot rendered on ports 2003 through 2009?

  24. Christophe, I got it to work. I only had to simplify the replace argument in Cameron’s code and Voila! the links started working.

    Thanks so much for this script. Much appreciated. Cheers!

  25. Hey again Christophe, I figured out the color and time on the calendar view. You used another script and that makes sense. waht I am trying to figure out today is can a list in a Sp site be displayed on a webpage with no webparts? I have a calendare with outage events. I what to just display the outage dates on the platform home pages. Even with absolutel URLs, just get the gears. can this be done with your script, or would it require major modifications.

    thanks larry

    • Good question, and the answer is: yes, this snapshot script will work on any Web page, even outside SharePoint. There’s one limitation though: JavaScript applies a same domain policy, so both pages should be under the same domain.
      There are ways to overcome the same domain limitation, but it is not straightforward, and not included in my code.

      • Perfect thanks. When I first fiddled with this I did not believe it worked. I forget to check the ID. Once I scanned the code after reading your reply, I found that and it worked. So now here are 2 more questions. The original list I linked to also used your HTMLcc. Because I was linking to an event calendar I had color coded events. Now pulling in this view, I lose the color coding. Because your HTMLcc script only works looking in webparts. withhout rewriting the script, is there a way to render the html on a simple html page?

        2. is there a reference somewhere that explains how to over come the domain limitation? Eventually I would like to make this work with the html page on the hosted site of the platform and pull the data in.

        • 1. You’ll need to run the Text to HTML script on the landing page, and synchronize it with the AJAX call.

          2. There are many workarounds, and I have lost track of their respective advantages and drawbacks (especially as it depends on the browser). Good keywords for a search are “Cross-domain AJAX” and CORS (Cross-Origin Resource Sharing).

  26. Hi Christophe: I am new to Sharepoint 2007 but have been following your posts which have helped me tremendously. I previously color-coded my calendar using one of your previous tutorials, but I am having trouble with this one. I am getting a 404: Requested URL not found error. Below is the code I am using:
    (Note: I am using Content Editor Web part [5], so I made the appropriate change to the code.

    if(typeof jQuery==”undefined”){var jQsrc=””;document.write(unescape(“%3Cscript src='”+jQsrc+”‘ type=’text/javascript’%3E%3C/script%3E”));}

    /* Cross-Site List Snapshot – v 2.0 * Copyright (c) 2009-2010 Christophe Humbert * */
    (function(){var ViewURL=” Calendar/calendar.aspx”,sec=0;$.ajaxSetup({error:function(x,e){switch(x.status){case 0: alert(‘Network issue.’);break;case 401: alert(‘401: Unauthorized.’);break;case 403: alert(‘403: Forbidden.’);break;case 404: alert(‘404: Requested URL not found.’);break;case 500: alert(‘500: Internal Server Error.’);break;case 503: alert(‘503: Service Unavailable.’);break;default: alert(‘Unknown error.’);break;}}});$.ajaxSetup({cache:false});var c=$(“#ListSnapshot”);c.removeAttr(“id”);var LoadView=function(url){c.load(url+” #WebPartWPQ5 .ms-cal-gempty”,function(){c.find(“.ms-viewheadertr th td”).each(function(){$(this).html($(this).text());});c.find(“*”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);c.find(“a”).each(function(){var s=($(this).attr(“href”).indexOf(“?”)>0)?”\&”:”?”;$(this).attr(“href”,$(this).attr(“href”)+s+”Source=”+location.href);});});};LoadView(ViewURL);if (sec>0) {setInterval(function(){LoadView(ViewURL);},sec*1000);}})();

    I appreciate any help you can provide me in trouble shooting this issue. Thank you!


  27. Hi Christophe,
    i used your old JavaScript for displaying a list on antoher site and it still even works great 🙂
    Now we are moving to SharePoint2010 Server and i didn t get it working anymore.
    Does it dont work for SharePoint Server 2010 or am i just to stupid?

    Wish you a nice weekend and lots of greetz

  28. Christophe,

    On my SP2007 site, the “Cross-Site List Snapshot, version 2.0 beta” code works great 🙂

    However, we just performed a test migration to SP2010 — that’s when I noticed the previously created web part was broken.

    I revisited the toolkit site and created a SP2010 compatible version of the same web part. I changed the web part from SP2007 compatible to SP2010 compatible, and I also pointed to the new list view (as shown in our SP2010 test environment).

    To my disappointment, I’ve been unable to get the modified code to wotk in SP2010. The gear icon displays with the uppermost rib pointing at 12 o’clock, then the gear icon disappears and nothing is displayed…

    Can you think of any reason why, the code that works so well in our SP2007 production environment doesn’t work (slightly modified) in our SP2010 test environment?


    • Christophe,

      I’ve got it working, however, I have a few remaining questions:

      1) Every time I open or edit a SP2010 page that contains the Cross-Site List Snapshot, I’m prompted by a warning message that says “this page is accessing information that is not under it’s control. this poses a security risk. Do you want to continue?”. My browser is IE8. I don’t know if any other browser would display this warning, but I would like to eliminate the warning. Can you recommend a way for me to eliminate this warning message? BTW, the warning does not pop up in our SP2007 environment…

      2) Is it possible to modify the code so I can reference the short version of the list view path? For example, how do I need to modify the source so it can use “/SiteCollection/SourceSite/SourceList/SpecificView.aspx” instead of “”?

      3) For me, I cannot display the cross-site list if I reference the duplicate/migrated list that exists in my SP2010 environment. But if I refer instead to the original list view that exists in my SP2007 production environment it works fine. Any idea why that would be so?

      4) In our SP2010 test environment #WebPartWPQ1 does not work, but #WebPartWPQ2 does… Is it a problem???


      • Dale, glad to hear it is working…kind of.
        The snapshot works fine as long as you stay in the same domain and same protocol (http vs. https). If you don’t respect these rules, the script will send warnings or just won’t work (in this case the debugging option will tell you).
        Within the same domain, the script will accept a relative path (your point 2).
        Whether WPQ1 or WPQ2 depends on your SP version – Maybe you are on MSS, not Foundation?

  29. Hi Christophe,

    Thanks a lot for your code. it helped me a lot.
    I’m facing one problem, i’m trying to show the calendar view from different web application. Calendar view works fine but it doesn’t show the ”
    Expand All Collapse All | Day Week Month ” all this option. So this is how it works for calendar view or m i missing something. Your help would be appreciate.

  30. Thanks, this works a treat. Is there any way I can get this to work with the TexTtoHTML script. When I use the two in conjunction txt is not resolved into html.

    Thanks in advance Tim

  31. Hello,

    Any chance that the script now allow to query content from a different domain ?

    In any case, this is already a great improvement, thanks.


  32. Hi,
    I am a huge fun of your scripts, thank you.

    I was trying to use this one, but when I added hidden CEWP with the generated script nothing happened. Could you please help me?

    if(typeof jQuery==”undefined”){var jQsrc=”http://xxx/_layouts/jquery/jquery-1.6.2.min.js”;document.write(unescape(“%3Cscript src='”+jQsrc+”‘ type=’text/javascript’%3E%3C/script%3E”));}

    /* Cross-Site List Snapshot – v 2.0 * Copyright (c) 2009-2010 Christophe Humbert * */
    (function(){var ViewURL=”http://xxxx/Test/Lists/List/AllItems.aspx”,sec=0;$.ajaxSetup({cache:false});var c=$(“#ListSnapshot”);c.removeAttr(“id”);var LoadView=function(url){c.load(url+” #WebPartWPQ2 .ms-listviewtable”,function(){c.find(“.ms-viewheadertr th td”).each(function(){$(this).html($(this).text());});c.find(“*”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);c.find(“a”).each(function(){var s=($(this).attr(“href”).indexOf(“?”)>0)?”\&”:”?”;$(this).attr(“href”,$(this).attr(“href”)+s+”Source=”+location.href);});});};LoadView(ViewURL);if (sec>0) {setInterval(function(){LoadView(ViewURL);},sec*1000);}})();


  33. Hi Christophe,

    I want to add the announcements from the home page onto the subsite home pages, is this possible with the above code?

    • You should be able to make it work, but I see a number of drawbacks:
      1/ You’ll need to find the specific id of your announcements Web Part (not necessarily WPQ1 or WPQ2)
      2/ You’ll be loading the whole home page in the background just to get the announcements, that’s a high price to pay.

      There are other techniques, like Web services, that are harder to set up but will be more efficient in the long run.

  34. Hello Christophe,

    I have a question about this code being used to show a snapshot of a list customized with InfoPath forms. I’m receiving an error message that began around the time the InfoPath customization was completed.

    I tried to send you an email at, but it was rejected.

    Can you tell me what address I can send it to as I have screen shots to explain my issue as I would really appreciate your help resolving this.

    Thank you!

  35. Nice way to use HTML for cross-site list view.. I would be interested to know what values can be added to this HTML script so that I can present only specific columns from that list

    • Mark, I think the easiest way is to create a view with only the columns you need, and then use the existing script to load that specific view.

  36. Pingback: A method to display a list in another site collection | SlicePlace - SharePoint

Comments are closed.