Displaying a SharePoint List from another team site in Sharepoint Foundation 2010

I remember I was using MOSS before and this is possible by using by connecting to another library like how it was disucssed in this blog http://sharepointgeorge.com/2009/display-sharepoint-list-site-data-view-web-part/, but now I had changed jobs and I am implementing the free version first which is the Sharepoint Foundation 2010 which have lesser functionalities than MOSS and one of it is displaying a SharePoint List from another team site.

The Sharepoint Foundation is locked down to display list data sources from the same team site but thanks to the Sharepoint webservices there is a way of doing it.

By default sharepoint have a suite of webservices available and these are the ones that are available

Now what we need here for this sample is the http://ServerName/_vti_bin/Lists.asmx.

Also in my sample I had created a filtered list so that anything that is ticked “publish to root” will be the only ones displayed on the list you want to compile.

This is a good way of separating your team site with the public site access, thus making the management of your announcements in one location and preventing giving access to users on your team site.

Note:  Thats is not a built in column and you have to manually create it.

Now from there you can now create your filtered list, here is the step by step process.

1. Go to List Settings

2. Go to the bottom of the page and click on create view

3. Choose standard view

4. Filter it according to the “publish to root” flag

5. Now your view is ready, click on it to view its List and View ID.

Take note of this and replace the characters “%2D” with “-”  so on this sample the List ID which is shown as 58a8179c%2Da062%2D4dec%2D9569%2D4f0d5518ebf8 will be 58a8179c-a062-4dec-9569-4f0d5518ebf8 and do that as well for the View ID.  Take note of this as you will be using this ID’s later

Now your everything is set up interms of your list data source, you need to now create your data source on Sharepoint Designer.  Fire up Sharepoint Designer and connect to your team site.

Now go to Data Sources and click SOAP Service Connection, then you can now define your Data Source.

Service location : /_vti_bin/Lists.asmx
Data Command : Select
Port : ListsSoap
Operation : GetListItems
Parameters : You need to fill up only listname and viewname and this is the one you had taken note a while ago.

Now go to General tab and give it a Name

And define Security Context on the Login Tab. Note: This is important as they security user that you will assign here should have access to the specific list thats why we havent used the Windows Authentication as it defeats the purpose of the one I discussed above (the two level announcement publishing) or you dont want to manage each users access to have view on specific List View.

Now go to any page you want to place your data view by clicking data view and choose your created SOAP Services Data Source.

Now the list will now show on the page but you still have to clean it up as it will be in its raw form, like title will have “ows_” prefix on it, the Body is formatted to text (you can format it to rich text like the one below), the author have some extra characters that you need to clean as well (you can do it by modifying the field to <xsl:value-of select=”substring-after(@ows_Author, ‘#’)” />, so it removes that extra characters).

Now you have it!

Another trick that I can share is that you can also merge different list you want to publish for example from multiple private team sites into the root sharepoint site by using the linked data source and choose any list you want to merge and join together into one data source.

22 Responses to Displaying a SharePoint List from another team site in Sharepoint Foundation 2010

  1. Kelsnz says:

    Your post above was great..! I followed your instructions (except for the “Publish to Root” part) but unfortunately, when I tried to add the Data View to a page, I get the error “The server returned a non-specific error when trying to get data from the data source. Check the format and content of your query and try again. If the problem persist, contact the server administrator”. When I create the Data Source, it connects with no problems and I have ensured that the parameters are correct with “{}” on either side. It still won’t connect…

    Any ideas..? I have created another View just in case but this did not appear to be make any difference.

    • rsmacaalay says:

      The error message is really not helpful but that is given as by default thats how Sharepoint presents it to you. You need to turn of Verbose errors so we can see the real problem then we can start debugging. To do this you nee to edit your web.config file which is located by default in C:\Inetpub\wwwroot\wss\VirtualDirectories\80\. Back up your web.config before doing some changes.

      Now here is what you ned to change on the line

      SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"

      Change the CallStack="false" to CallStack="true"

      this will enable the setting to give you detailed error codes

      Then in the line

      customErrors mode="On"

      change it to

      customErrors mode="Off"

      These are case sensitive, once done, save and do an IIS reset then you will now see the real error. Now were one step away from fixing the issue. Hope this helps

      • Kelsnz says:

        Thanks so much for your response above. I did as suggested above and changed the web.config file and did an iisreset (I even did a server reboot) and tried to add the data source again but the error is exactly the same – no more detailed error in SPD.

        I have created two data sources – one with {} around the listName and viewName and one without. I have also tried different login credentials (both domain accounts). I can browse to the address with no issues – http://***/_vti_bin/Lists.asmx

        Any other ideas.???

    • rsmacaalay says:

      Have you tried Windows Authentication? If you can try them first so we can eliminate the possibility of Authentication Error.

  2. Kelsnz says:

    I tried Windows Authentication but this unfortunately does not make any difference.


  3. Bram says:

    Is it also possible to create the link and get the silverlight box just as an announcement in the normal standard view / list?

    • rsmacaalay says:

      Sorry I quite did not get your question , can you elaborate further?

      • Bram says:

        In the normal announcement lists you have the title that is clickable, then there is a pop-up that displays the announcement (like the body text). I did follow your guide and now i can get an copy on the other site, but i want it also to be clickable like on the normal announcement list.

    • rsmacaalay says:

      Yes you can just interpret the row on the datasource called ows_FileRef as a hyperlink your needed info will be in that row.

      ie. the data looks like this


      what it means is that that announcement item is in SubSite under the Announcements List and the ID of that item is 4, so in hyperlink terms it would be


      To do that you need to format the title as Hyperlink as

      concat(‘../’,substring-after(substring-before(@ows_FileRef, substring-after(@ows_FileLeafRef, ‘#’)), ‘#’),’DispForm.aspx?ID=’,substring-before(@ows_FileRef, ‘;’))

      • Bram says:

        Thanks for the info, but i’m getting an error some ‘ isnt closed? I’m no programmer so i’m a bit confused what isnt closed and what is. Do i also need to replace the # with a value?

      • flavio ribeiro says:

        Hi, I got the same problem, what you did to fix this issue?

  4. Bram says:

    Ok got it to work, but is it also possible to make it like a Silverlight box as the normal announcement list?

  5. Daniel says:


    I am seeing some odd behaviour when I render @ows_FileRef when I pull in List data from a document library on another site collection in DVWP.

    Should just display #15/sites/home/mysite/nameofdoc.docx … ( yes I know I need to clean this up)

    when I click on the link in the DVWP sitting on the test site

    I get http://domain.com/sites/other/test#15/sites/mysite/nameofthedoc.docx

    This of course will give an error. So why is SharePoint prefixing the file in DVWP with the current location not what is passed back from my datasource. It is drving my nuts.

    • rsmacaalay says:

      Sorry for my late reply was in TechEd for last week so go no time to answer your query, anyways I use a mix of Javascript and XPath Expressions to achive a cleaner solution for this one.
      Here is what I had done.

      Open your page in advanced mode in Sharepoint Designer then just after the


      in the


      where your DVWP is lying add this JavaScript to generate a link

      <script type="text/javascript">
      	function GenerateFilePath(link) {
      		return ("<a href='" + location.protocol + "//" + location.host + "/" + link + "'>" + link + "</a>");

      then on your cell where you want to show the link place this piece of code

      <script type="text/javascript">
          document.write(GenerateFilePath('<xsl:value-of select="substring-after(@ows_FileRef,@ows_ProgId)" />'));

      Hope this helps

      • ssvv says:

        This worked like a charm for me…thanks a lot.

        Using the code above, I was able to display the link on my DVWP. In SPDesigner no value or link appears in the cells, but when I open DVWP on my site it shows the link to the document.

        Since my DVWP shows the link path, I wanted to know if there is a way I can modify the JavaScript or code to display the document title (@FileLeafRef) with the file path as the value (@FileLeafRef).

        (Ex. currently my file hyperlink shows as ‘site/subsite/library/document1.docx’, is it possible to maintain this path but make the display text ‘document1.docx’?)

        Thank you.

    • Daniel says:


      Thanks for your advice. The url now is displayed is now valid and goes straight to the relevant document…

  6. Bruno Okamoto says:


    Is it possible to display a customized “New Item Form” of a Survey located in a Subsite on the Top Site?

    (Actually, what I have is a subsite with polls (using the survey list with 1 question and a few options.
    I’d like to show one of the polls on the top site and I’d like to customize the poll view with xsl and obviously allow users to vote once)

    I tried the operation GetListItem e GetList, but both operations don’t bring what I need (the question and the options)



  7. Pingback: How to Archive SharePoint List Items to SQL Server | Raymund Macaalay's Dev Blog

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

%d bloggers like this: