Display a list in another site (Cont’d)

Two months ago I published a simple method to display a SharePoint list in another site.

A few days ago, Nathan posted the following comment:

The one (minor) inconvenience I have found is that when you click the ID or Title field to navigate to the full record (dispform.aspx), the Close button will redirect you to the default view of the source list […] Would it be possible to modify the script in order to append something like Source=location.href to the ID/Title hyperlink? That way, the Close button on dispform.aspx would redirect you back to the starting page.

So here we go. As Nathan points out, SharePoint offers a very convenient “Source” querystring that tells where the user should be redirected after an action is completed.

This is the modified JavaScript version:

<!-- Load and display list - iframe version -->
<!-- Questions and comments: Christophe@PathToSharePoint.com -->

<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("WebPartWPQ1") ;}
   else if(sourcelist.contentWindow)
      // Internet Explorer

      {displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ1") ;}
   else if(sourcelist.document)
      // Others?

      {displaylist = sourcelist.document.getElementById("WebPartWPQ1") ;}
}
catch(err) { alert ("Loading failed");}

displaylist.removeChild(displaylist.getElementsByTagName("table")[0]);
var allDescendants = displaylist.getElementsByTagName("*");
for (i=0;i<allDescendants.length;i++) {
allDescendants&#91;i&#93;.removeAttribute("id");
allDescendants&#91;i&#93;.removeAttribute("onclick");
allDescendants&#91;i&#93;.removeAttribute("onfocus");
allDescendants&#91;i&#93;.removeAttribute("onmouseover");
try {
if (allDescendants&#91;i&#93;.href.indexOf("?") > 0) {allDescendants[i].href = allDescendants[i].href + "\&Source=" + location.href;}
else {allDescendants[i].href = allDescendants[i].href + "?Source=" + location.href;}
}
catch(err) {}
}
placeholder.innerHTML = displaylist.innerHTML;
}
</script>

And the modified jQuery version:

<!-- Load and display list - jQuery version -->
<!-- Questions and comments: Christophe@PathToSharePoint.com -->
<DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>

<script type="text/javascript">
// Paste the URL of the source list below:
var SelectedView = "http://domain.com/SiteCollection1/SourceSite/SourceList/MyView.aspx";
$("#ListPlaceholder").load(SelectedView+" #WebPartWPQ1 .ms-listviewtable",function() {
$("#ListPlaceholder *").removeAttr("id").removeAttr("onclick").removeAttr("onfocus").removeAttr("onmouseover");
$("#ListPlaceholder a").each(function() { 
if ($(this).attr("href").indexOf("?") > 0) {$(this).attr("href", $(this).attr("href")+"\&Source="+location.href);}
else {$(this).attr("href", $(this).attr("href")+"?Source="+location.href);}
});
});
</script>

See the original post for more details. In particular, if you are using MOSS remember to replace WebPartWPQ1 with WebPartWPQ2 in the above scripts.

Update (March 24th): I have modified yesterday’s post to make the scripts work for document libraries as well. I have also corrected the jQuery version (thanks to Peter Allen for alerting me).

Update [6/16/2009]: I have modified the jQuery code for better performance. Thanks Danny van Loon for the advice!

119 thoughts on “Display a list in another site (Cont’d)

  1. Pingback: Monday Morning SharePoint | End User SharePoint

  2. This is a fantastic and timely tip! I just cut, pasted changed the URL and all the 01s to 02s and it worked!

    It’s great for displaying data from a list in another site, but of course I’d really love to take it one step further – I’d like to use Web Part connections to be able to filter the data by a selection on the page. Any ideas?

  3. Glad to help 🙂
    It’s a convenient method, but don’t put your expectations too high… For Web Part connections, your best bet is SharePoint Designer.

  4. You’re right – I added the other list as a data source in Sharepoint Designer without any trouble. I don’t know why it hadn’t occurred to me to try before!

    I wish the Help on Sharepoint designer were more useful – it’s such a powerful tool and yet a challenge to discover the things it can do!

  5. Pingback: Recap of the Last Week and Then Some « Steve Mullen’s Blog

  6. Hello Christophe
    This script is very helpful as I needed to share some list amongst some different site. The only problem is that I wanted to share a list with a grouped view. I’ve tried but I can’t open the contents of each agrupation. Would it be posible to see a grouped one?

    Regards and thank you for this beautiful blog

  7. Sorry Antonio, the current script only keeps text and hyperlinks. More advanced actions, like the collapse/expand buttons, context menus and the toolbar are lost in the transfer.

  8. Is there a way to remove the list headers? I would just like to display the contents of a list w/o any table headers.

  9. Cristophe, I am sorry I have been remiss in saying “Thank you!”. I immediately updated my webpart and it works beautifully (and with only a couple additional lines of code). In theory, I knew it was possible, but I am too new to Javascript to have made it happen on my own. Thanks for helping out. I hope that I’ll be able to put some of my other theories into practice one day to pay back the Sharepoint user community from which I’ve so greatly benefitted!

  10. Just a quick update regarding the Sites list that is provided if you use a standard “Site Directory” template with MOSS, You have to use WebPartWPQ1 for this to work.

    There seems to be all kinds of problems using the site directory (I wanted to show specific cut down views on the Site Directory for various container sites I had in heirachies around the place.

    Tried to use Sharepoint Designer and create a view, but there seems to be something funny with this list and I was getting all kinds of errors like “the list that is referenced here no longer exists” when trying to do filters and one of the fields that I wanted to filter on (which was a multiple option list) wasn’t available and if I copied the list view I had nothing but errors.

    This iframe method works pretty well, although there is no clickthrough which is a shame. If that could be made to work, this would be perfect.

  11. Pingback: SharePoint list with auto-refresh « Path to SharePoint

  12. excellent work. In my view that i created I limited the number of items to 10 so a pager shows along the bottom. however, clicking this pager creates a javascript error:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8)
    Timestamp: Thu, 30 Apr 2009 15:52:19 UTC

    Message: Syntax error
    Line: 1
    Char: 1
    Code: 0
    URI: https://domain.com/docs/default.aspx?PageView=Shared

    Is it possible to modify the pager in your javascript to show the next/previous page of the view when it’s clicked?

  13. To echo the comments received from many of the folks here already, “thank you” for providing this script. I’m implementing it on an internal site Web Part page together with a linked map of corporate office locations.

    What I’m wondering, is whether it’s possible to change the value of the SourceList src url through the use of another event employed elsewhere on the page (I want to be able to change the selected list’s view).

    You’re using the onboard event to initially load the src image. I thought it might be possible to use another event, such as: =”document.getElementById(“SourceList”).src=’new url'”).src=’new url'” but haven’t had any success. The challenge seems to be in getting that new url information passed back into DisplayThisList().

    My Java/Javascript is a little rusty (and was wimpy to begin with). Is it possibly to modify DisplayThisList() so it takes a url for SourceList as it’s input?

  14. typo in my previous comment. the other event should have read as:

    onClick=”document.getElementByID(“SourceList”).src=’new url'”

  15. I am using the javascript. What I ended up doing was replacing the paging with a link to the actual library like this:

    if (allDescendants[i].className==”ms-paging”){
    allDescendants[i].innerHTML=”To see all items, go to My Library“;
    }

    Then the view just shows the number of items i specify in the sourceview and users have to click the link to see all the items of the library.

    However, if there’s an easy way to actually have the pager work, that would be preferred.

  16. I am currently using this to pull 2 different views from a subsite to the mainsite, but I am running into a problem.
    If both webparts are visible then they just clock trying to load the values. If only one webpart is visible it shows the correct values. I am going to different lists for this, but I still can not seem to figure out what I am missing, any ideas?
    source 1 is: http://mydomain/sites/mysite/mysubsite/lists
    source 2 is: http://mydomain/sites/mysite/mysubsite/Announcements

  17. Heya Cristophe,

    I really like the JQuery version for displaying lists, I however have the following suggestion to increase performance.

    $(“#ListPlaceholder *”).removeAttr(“id”).removeAttr(“onclick”).removeAttr(“onfocus”).removeAttr(“onmouseover”);

    Or if you want a prettier version.

    var allElements = $(“#ListPlaceholder *”);
    allElements.removeAttr(“id”);
    allElements.removeAttr(“onclick”);
    allElements.removeAttr(“onfocus”);
    allElements.removeAttr(“onmouseover”);

    You should notice a significant perfomance increase, especially for larger lists.

  18. Hey Christophe, hope all is well. It has been some time since I last visited your site of many treasures. I have been thinking about a functionality that multiple posts of yours, combined, woudl accomplish. Just not sure if I can reach it. I have a document library, actually a forms library containing InfoPath files. I want to build a table of contents, that uses data from three of the columns so the TOC has 3 levels
    Master Process
    – Sub Process
    – – Service.

    I have these columns already set up. what I think I need is to count the items, and divide by 3 of 4, for my columns in the TOC, sort and group the items by levels and apply formatting, meaning the the lower the level the smaller the text just like Ms Words TOC.

    Then your 2 level dropdown script takes this another step and it uses a list to populate values.

    If your scripts can read, display a list or list items that is half the battle.

    How could I approach looking at my list of items and building a web TOC?

  19. Christophe,

    I used your javascript successfully when I wanted to use two different lists from my main site on one of my subsites. However, when I tried to also use those same lists on some of my sites that are on another domain they would not work. The clock just keeps spinning. Is this a limitation of this script? Can you help me?

    Thank you very much, Scott

    • Scott: JavaScript/AJAX doesn’t work across domains. This is a general limitation, not specific to my script.
      I am currently investigating cross-domain solutions. It means combining JavaScript with other tools that work across domains.

      • Thank you Christophe. I appreciate the time you spend helping us to improve our SharePoint implementations. I will stand-by for any future solutions you might be able to offer.

        Scott

  20. Many thanks for this script.

    Is it possible alter so that all list items open in an iframe?

  21. Greetings,

    Thanks very much for the code and the learning experience. However.
    (don’t you hate that…)
    I can get both versions to work, but only separately. I cannot get the jQuery version to work on a page by itself. The only time the jQuery version works is if I load the iFrame version first. If I load the iFrame version, that works. Then I add a CEWP for the jQuery version and that works, but the list in the iFrame version disappears.
    I’ve tried the number solutions in the comments. I even did a view page source on your demo site, copied the code for the two versions, changed the path to my list, and only the iFrame version shows.

    Thanks again, but any thoughts would be appreciated.
    al

  22. This post is great. I did want to ask if you had any luck working out a cross-domain solution? I have a list displaying on another domain site. The only thing is that it the urls link within that domain and not to the appropriate. Do you have any suggestions?

    • David, I have no solution to recommend. Try searching the Web for “XHR”and “jQuery”, or “XHR” and “Flash”, and you’ll get a couple options.

  23. I have implemented the list sharing between sites, and it works well, as far as the display. But when I try to sort the lists by a column on the page where they are displayed using the code and the CEWP, I get an error. Any idea why?

    • I recently added this functionality into the script with the following
      //Make the titles sortable
      function setColumnClicks(){

      $(“#ListPlaceholder a[sortingfields]”).click(function(){
      var srtFields = $(this).attr(‘sortingfields’);

      $(“#ListPlaceholder”).load(SelectedView +”?” + srtFields + ” [id^=’WebPartWPQ’] .ms-listviewtable”, function(){processView();setColumnClicks();});
      });

      }

  24. This is a very useful script, however I cannot get it to show multiple lists.
    Can any one supply me with some example code? Please.

  25. I have used this code successfully for the one and only webpart on the page, but when I tried to add more webparts and load them with different lists from other sites, the gear.gif keeps spinning. Is this mechanism useful for only one list per page?

  26. Hi Christophe,

    Thank you for the post. I have tried using Document Library List source, and I am getting the continuos spinning green image without any results. and i have replaced the the code with ‘WebPartWPQ2’ and added my source lsit URl. is there anything that i am missing. appriciate your response. thanks in advance.

  27. Hi Christophe,

    Thank you for the post. I have tried using Document Library List source, and I am getting the continuos spinning green image without any results. and i have replaced the the code with ‘WebPartWPQ2’ and added my source lsit URl. is there anything that i am missing. appriciate your response. thanks in advance.

    • Naresh: nothing else, it should work. You can check this:
      1/ confirm that you are on MOSS (not wss), which is why you’ll use WebPartWPQ2
      2/ make sure your page and the original list are on the same domain (www.domain.com).

      • Thanks for the Quick Response Chrstophe,

        I am able to get the list data with in the same site but can not get the list data into a different site. I have 1 site collection and host name is fully qualified name , http://soapc.com and i have a subsite http://soapc.com/subsite1 . can i acess the list from this sub site. thank you.

  28. Just an addition to my previous post.. the spinning image with no results occues when i try to access the list from a different site. thank you.

  29. Hi,
    I have somehow similar requirement but may be an extension to somewhat posted here..
    I want to have a list kept onto a site, say A, and want to use that same list,without creating it, onto another site,say B. Onto site B it will be a lookup column of a Document Library. This look up column will act as a meta tag of the documents stored onto the Doc Lib.

    Both the sites i.e. A & B are onto the same sharepoint server.
    By the above post I have been able to share the list as a webpart onto the other site B, but I am not being able to use it as a lookup column onto this site.

    Nevertheless this was an excellent post.

    • For cross-site lookup, try using the OOTB SharePoint feature. If you create a list at the top level of your site collection (not in a sub-site), you should be able to reference it in lookup columns.

  30. What would I need to add to the javascript to get the webpart to refresh every 30 seconds, ive found how to refresh the whole page but it would be much better for just the webpart content.

  31. Hi Christophe, I notice you have already been asked if this will work with Calendar Views by ‘Marshal’ on Sept 4th, to which you replied ‘it should do with minor adjustments’. I’ve tried the code, both JavaScript and jQuery, to display a Calendar View on another site but nothing is shown once the ‘scripts’ complete their load. I’d be most grateful if you could advise what the ‘minor adjustments’ you refer to might be as I’m afraid my knowledge of either code is very limited. Thanks, David

  32. Christophe, great work on the script. I’ve successfully used it. However, is there any way to apply CSS to the iframe to make it more consistent with the page styling? I’m trying to make the title field bold using the .ms-vb2, .ms-vb-title for lists on the current site, but it doesn’t work for the cross site list.

    • Vinod, you should be able to utilize the .ms-WPtitle Span{} Tag to modigy the font color, size and I believe you can bold it as well. This will allow you to force a standardized look across your page.

      • Is there a way to use CSS to modify the font or column widths of the data that is retrieved? I can do it on the list view using a CEWP, but not sure how to translate that over to this web part as I no longer have the same tags to look for

  33. Hi

    This site is really good. I have a quick question, I have implemented the HTML calculated column on my top level site. I then pull from the top level site using the JS version of the script the same information. I get the fields back correctly i.e. the HTML code in the calculated column however it is not rendered. I have added the two CEWP to my page.

    Any thoughts?

  34. Hi – Fantastic resource and thanks to everyone that is contributing…

    I wanted to ask if there was a way to display a filtered rendering of the list – without created a filtered View and referencing that. I have a number of subsites under a master site and I want to display a different single record froma master list in the parent on each.

    Any help and suggestions greatfully received.

    Thanks

    Paul

  35. Pingback: SharePoint CEWP Solution Interface - Part II | EndUserSharePoint.com

  36. Hi,

    I am trying to use the auto-refresh of list for a discussion board in the flat view and wanted to make the list refresh every few seconds.
    My goal is that if a discussion is going on it will load the replies immediately withhout having to refresh the page.

    I do see the cursor changing to hour glass for every 10 seconds, but the list is not getting updated. Am I missing something here?
    I would really appreciate any help.

    Thanks,
    Madhu

    • Madhu, this method is too heavy and not adapted for frequent refresh. You’d better consider other solutions, using for example XML or JSON.
      That said, there could be a caching issue in your case. Which solution are you using, the JavaScript or the jQuery one?

  37. Hi Christophe,

    Thanks for getting back to me, I am using jQuery code.

    I have been trying to find a way to refresh the Discussion board web part, I have used Ajax before but it was for custom web parts.
    I am clueless of how we could refresh a built in web part.

    I am not familiar with JSON, but thanks for the suggestion I will look into it.

    Thanks,
    Madhu

    • Try this: at the beginning of the jQuery code, add the following line:
      $.ajaxSetup ({ cache: false });
      I’d also recommend that you increase your refresh delay (how about 1 min?)

  38. What did I miss??

    I have tried everything in both posts and all comments and all I get is the “gears” spinning; there are no error messages. Do I need to add anything else on the page, like another helper CEWP, or is there any other post I should read for something that needs to be implemented before this will work? Does the order of the “source” and “target” sites matter (e.g., target should always be subsite of source site, etc.)?

    I am using WSS 3.0. My site and all subsites are in a single domain, no HTTPS, not trying to display multiple lists on the same page, nothing funny. I am trying to display the default view of a document library from one subsite on a web part page in another subsite (i.e., display http://domain/siteA/docs/forms/allitems.aspx on http://domain/siteB/docs/webpart.aspx) – this seems like it should be straightforward…

    I have successfully implemented the calculated column on the same site in numerous pages without issue. I was also able to follow and successfully implement the post titled “Display the Quick Launch in a Web Part page”…given these easy successes, I figured this would be easy as well.

    Any help would be appreciated! Thank you.

    • Three things I forgot to mention:

      1. I am using the iframe version

      2. When I remove ‘style=”display:none;”‘ I see the document library page (just like if I added it in a Page Viewer Web Part, with all of the original page decoration) in a small iframe under the gears…but the gears remain and the iframe the page is in is tiny – maybe 100×100.

      3. The page loads successfully and completely. I see it loading data from the source page in the status bar area and this task completes (seemingly) successfully.

      Thanks again for any help!

      • Matt, I’m in exactly the same boat. I’m not able to deploy any third party webparts to achieve this, so this sort of “workaround” solution is the only I found, but I’m also not able to see any results. Same as you, I’m on WSS 3.0

        Have you managed to get yours working?

        • Hi Alex. No, I have not found out what the problem is. I have a second WSS 3.0 site used for external partners (completely separate databases and installed on different box, but otherwise same service pack levels and such) and the solution outlined here works just fine on that site!

          The only major difference I can think of between the two sites, other than the actual physical server they’re installed on, is that the site with the issue is also utilizing MS Search Server 2008 Express for search results. The rest of the differences are small and not easily testable (e.g., edited default.master to integrate “drop-down” menus for the Top Link Bar and other small interface tweaks – nothing that you would think would break this).

          I redesigned my current project to remove the requirement to display items from another list. This was easier and quicker than tracking down the one thing that is causing the issue…I wouldn’t really even know where to start on that!

          Sorry I cannot help more. Good luck! Let us know if you come up with a solution.

        • Sorry. Not sure how I missed typing my name on my last comment. The “anonymous” reply is really from me.
          – Matt

        • Thanks, Matt.

          We also have MS Search Server 2008 installed on the WSS server and I also did only minor tweaks of the master page. I’m afraid I’ll have to put it in the “too hard” basket. The problem is that I can’t just redesign the site, as it’s already being used by end-users. Looks like I might have to use SharePoint Designer and Data Views to get the results that I need. Thanks for a quick reply.

          Cheers,
          Alex.

        • Wow, I just got this to work…well, sort of. I was trying to get another script to work (that would allow me to open external links in a new window), and in the proccess I removed the following javascript call from the Body’s ONLOAD method:

          javascript:if (typeof(_spBodyOnLoadWrapper) != ‘undefined’) _spBodyOnLoadWrapper();

          I know this is a major hack (my top nav drop-downs no longer work), but I got this “display list” script to work. I also had to replace WebPartWPQ1 with WebPartWPQ2.

        • Ok, I just put the if (typeof(_spBodyOnLoadWrapper) != ‘undefined’) _spBodyOnLoadWrapper(); back into the Onload event and everything still works. I guess the ElementId WebPartWPQ2 was the main thing to fix.

        • Alex, you’re a genius! I changed WebPartWPQ1 to WebPartWPQ2 and now it works perfectly. Great job! Thank you for sticking to it. 🙂

  39. Hi Christophe
    Great site I have used two ideas from your site one being the KPI’s and the other showing lists in another part in MOSS. One problem I have however is changing the column sizes on a KPI list (as I have quite a few KPI’s per project). I have tried SPD and changed the format of the list to XSL however that stuffs up the script for the traffic lights I’m using. Can you help here? Thanks!!

  40. Hi Christophe,

    This works great, thank you!
    Because MOSS doesn’t allow you to connect webparts on dispform.aspx without doing “tricks” like converting a part to XSLT, I would like to use this method and create a filter based on the URL ID.

    I found that you can filter this list manually by copying the fieldname and manually entering a value.

    eg …src=”Site/allitems.aspx?FilterField1=Project%5Fx0020%5FRef&FilterValue1=21″

    but how can I script it so that it pulls the Filtervalue1 from the URL “ID=X” ?

  41. As always, Christophe, you have a simple answer to something I’ve been wrangling with for weeks! This works perfectly – thank you so much for sharing your expertise and knowledge with us!

  42. I’m not able to get this working in my env. I’m using MOSS and have edited the script to change WEBPARTWQ1 to 2. I added a CEWP and changed the link to a list (default view) on another site collection and the gears gif just spins and never stops. The list I’m pointing to is just a link list. I’d like to get a simple version running before moving on.

    Any suggestions? This looks be pretty straight forward too 😦

      • I would have considered that if I wasn’t a farm admin 🙂

        Just to verify what I did.
        1. Choose link of list to display from one site.
        2. Add CEWP on site where I want to display first sites list
        3. Paste either of the code examples above in this CEWP and change the #WebPartWPQ1 to #WebPartWPQ2 (Since I’m using MOSS)
        4. Apply changes and see output.

        After this, the gears just spin and never stop. (waited for a while)

        • I’m back 🙂

          Here is a screen shot of of the script area where you modify your script including the URL. I have other webparts using JQuery so I know that’s fine. Both sites are in the same site Collection. One is the subsite of the other, so this should be a simple scenario based on others commenting above. Tell me if you see anything wrong:

          // Paste the URL of the source list below:
          var SelectedView = “http://immosutvip/sites/BDEV/FMR/External%20Dist/Forms/AllItems.aspx”;
          $(“#ListPlaceholder”).load(SelectedView+” #WebPartWPQ2 .ms-listviewtable”,function() {
          $(“#ListPlaceholder *”).removeAttr(“id”);
          $(“#ListPlaceholder *”).removeAttr(“onclick”);
          $(“#ListPlaceholder *”).removeAttr(“onfocus”);
          $(“#ListPlaceholder *”).removeAttr(“onmouseover”);
          });

  43. Hi Christophe,

    I managed to get a document list from another site (on the same domain) to show up on the other site, however, the document context options (checkout, version history, edit in ms powerpoint) are not showing up. It works only like a link to the document, can any of you guys suggest a fix for this? Thank you very much.

    • Marco, see this method as a kind of screenshot. Functions don’t work because the reference to the original site is lost. I actually remove them in the script (removeAttr).

      • Thanks for your reply Christophe.
        Are you saying its just not possible to do it, or just that your script wasn’t meant to do it in the first place?

        It would be great for my application if I could provide an alternate location for editing this document list (both sites are mine).

        • You could certainly do it, but it is not straightforward and maybe not worth the trouble. Have you considered using a Data View Web Part or a Page Viewer Web Part?

  44. Christophe,

    Great piece for work, which I’ve finally got to work. However on the list view I have a column for email address and it shows as

    mailto:dfgdgg@ffdfdf.com?
    Source=http://domain/page.aspx

    for each element of the view and it is ‘active’ and creates an email if clicked. The original column is a simple one line text field and I had the same problem using the ‘Hyperlink or Picture’ column type. I can’t use People or Groups as not all the contacts I need to display are members of the same AD.

    I really need the email address to show properly though it doesn’t have to be active.

    Would appreciate yours or any others comments on possible resolutions.

    • Solved the problem, though lost functionality!

      By the way I’m using the jQuery version on a MOSS site.

      By removing the code you added to enable the return to the original starting page, where the list view was being displayed, the email addresses are correctly rendered.

      Is there a way of amending the ‘redirect’ part of the code to ignore email addresses?

      Regards,

      • Thanks for this useful feedback David. The answer is yes: you can select which hyperlinks you apply the redirect to, just like we do for tooltips. I’ll work on an update.

        • Thanks Christophe.

          Interestingly I used the full code on a list view that included embedded hyperlinks created in a Rich Text field (not my choice of method!) and they did not suffer the problem I encountered with the emails.

          Finally I can confirm – it may already have been mentioned in the lengthening comments above – that your code works across ‘site collections’ on the same domain.

          Regards,

          David

        • Hi Christope, I have the same problem that David but using a rich text column would not be a solution in my case…. Do you have an update of the code to select which hyperlinks the redirect to will be applied?.. Thanks.

  45. Hi Christophe,

    I have played around with Data View Web Parts in Sharepoint designer,
    but it seems you need more than basic read rights just to define the data source. Does this means all users opening the page would need these rights?

    on the other hand, I tried removing the “removeattributes” statements but that did nothing. Is there a chance you might update the script to allow this functionality?

    Thank you very much!

  46. There is a font difference in the main list and the CEWP list, is it possible to keep the font format same as the Parent list.

    • A font difference? Are you using different themes or stylesheets on the source and target pages?
      With this method the HTML is embedded in the target page and will naturally adopt its style. If you need to keep the original style, a Page Viewer Web Part would be better adapted.

  47. This script is fantastic! I’m currently using some (borrowed) code that I picked out of your Gantt calendar examples on the CrossSite page on your SharePoint site and it’s working -almost- flawlessly.

    The only flaw is that the iframe can’t seem to pick up the Default SharePoint theme. If the site on which I load the script is anything but the Default Theme, then it works just fine.

    I believe my genius SharePoint server admins changed the name of the default theme from simply “Default” to “Default Theme,” and that’s probably why it’s messing up. Is there anything I can do in order to get the script to pull the right information from the differently-named theme?

    If you have any questions about this, please let me know. It’s kind of difficult to describe, but I hope I got my point across.

  48. Christophe

    I’m using your iFrame script to bring a Calendar to another site. Problem is when I click on the “1 more item” link or try to advance retard the month nothing happens accept I get ‘Error on Page’ appear in the bottom left of IE.

    Can you shed some light…

  49. Read a bit more and dicovered this is a problem that has no easy fix. I was wondering however, is there a way that within the script, the month selector could be hidden.

    • You’ll need to find which element contains the month selectors, and hide it or remove it AFTER the calendar is loaded on the page. My “Tiny calendar” posts show some examples of hidden buttons.

  50. Pingback: Create a Polling Web Part with SharePoint Designer and the DVWP | EndUserSharePoint.com

  51. Hi Christophe,
    Is there any way to show the total number of items in the list being displayed. I’m using the jQuery version and have added a title above the script and would like to have the number of items shown here.

    I can use the OOTB count item from the list view but ideally want that number to show in the title. The title expands/collapses when you click on it so the user would have to expand the list in order to get the “Count” figure.

    Sue

  52. Thanks for the nice article.But I need to display list contents from workspace list into another domain workspace.Can you please suggest me.

    Regards,
    Anil

  53. I am really struggling in this, sourcelist.contentdocument is not working,

    Please help?

    Regards
    Amit

  54. Hey! This post couldn’t be written any better! Reading this post reminds me of my good old room mate! He always kept chatting about this. I will forward this page to him. Pretty sure he will have a good read. Thank you for sharing!

  55. Excellent blog right here! Also your website quite a bit up very fast!
    What web host are you the use of? Can I am getting your affiliate link in your host?

    I want my website loaded up as quickly as yours lol

  56. Pingback: Create a Polling Web Part with SharePoint Designer and the DVWP | test

Comments are closed.