Displaying a SharePoint List from another team site in Sharepoint Foundation 2010
July 13, 2010 21 Comments
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
- http://ServerName:99999/_vti_adm/Admin.asmx – used for creating and deleting sites, change 99999 with your administrative port number
- http://ServerName/_vti_bin/Alerts.asmx – used for working with alerts
- http://ServerName/_vti_bin/DspSts.asmx – used for retrieving schemas and data
- http://ServerName/_vti_bin/DWS.asmx – used for working with Document Workspaces
- http://ServerName/_vti_bin/Forms.asmx – used for working with user interface forms
- http://ServerName/_vti_bin/Imaging.asmx – used for working with picture libraries
- http://ServerName/_vti_bin/Lists.asmx – used for working with lists
- http://ServerName/_vti_bin/Meetings.asmx – used for working with Meeting Workspaces
- http://ServerName/_vti_bin/Permissions.asmx – used for working with SharePoint Services security
- http://ServerName/_vti_bin/SiteData.asmx – used by Windows SharePoint Portal ServerName
- http://ServerName/_vti_bin/Sites.asmx – used to retrieve site templates
- http://ServerName/_vti_bin/UserGroup.asmx – used for working with users and groups
- http://ServerName/_vti_bin/versions.asmx – used for working with file versions
- http://ServerName/_vti_bin/Views.asmx – used for working with views of lists
- http://ServerName/_vti_bin/WebPartPages.asmx – used for working with Web Parts
- http://ServerName/_vti_bin/Webs.asmx – used for working with sites and subsites
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.
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).
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.