Access Data Sources Across Site Collections or Web Applications
By: Rahul Mehta | Comments | Related: > SharePoint
Gathering data from different sources or parts of a web application in SharePoint can be tricky. Consider a scenario where one needs to gather data from the entire web application as well as from data sources outside the web application. In MOSS 2007, one of the ways to achieve this is by using a new feature named Data Views in Microsoft SharePoint Designer 2007. In this article we will discuss how one could connect to another application and use it as a data source.
The "Data View" is a feature that facilitates gathering data from different sites of a web application. It is an out of box feature, which means one could directly use it from the toolbox of SharePoint Designer 2007. For using a data view, open a website in Microsoft Office SharePoint Designer 2007. Then Go to File -> New -> ASPX to create a fresh new aspx page. You will come up with something like this below.
At the top, you could see an entirely different menu available for "Data View". To insert a data view into the aspx page, click on "Insert Data View" from the "Data View" menu. A "Data Source Library" Pane will appear on the right of the page.
For the problem in question, we will gather data from another site collection which is similar to gathering data from a different web application. At the bottom of the data source pane, there is an option of "Connect to another library". Click on that option. As soon as you click on that option, you will be prompted to Manage Library. Click on Add to add new data to gather from.
Enter details of collection that you want to include at the current point. It would be something similar like below:
Key in some name in Display name property, and this name would be the name of the data source. For selecting a location, click on "Browse".
You could select a different library, list or site collection from same or another web application. In our example, I've selected data from another site collection in same web application.
Click OK on Collection Properties and Click OK on "Manage Properties". Now you should be able to see your data source added into data source pane at right side.
To view data on the page from the newly added data source, which in our case is "OnTheJobCol", all you need to do is select a specific data source like SharePoint Lists, SharePoint Libraries or others.
- Click on the specific "Data Source like SharePoint Lists, SharePoint Libraries and others", and then "drag and drop it on DataFormWebPart area" on page which will show all metadata with standard format and sample data on page.
- Click on the specific "Data Source like SharePoint Lists, SharePoint Libraries and others", and then click on "Show Data" which allows to select specific metadata from the data source and display it on "DataFormWebPart" area on the page.
- Check out MSSQLTips.com for great information about Microsoft SQL Server.
About the author
View all my tips