Display a sharepoint list in another team site
There are various ways to achieve it.
- Using the Web Services.
- REST API (Representational State Transfer API ) which is nice and bit simpler.
- You could use the Client Object Model.
- Using SPSiteDataQuery object is the core of the content query web part.
Today I am giving you how to use SPSiteDataQuery:
You can use an instance of this class to retrieve data from selected lists or from all lists in the current site collection. Specify the scope of the query by setting the Webs property. Specify the lists to participate in the query by setting the Lists property and the fields to return by setting the ViewFields property. Control data selection and order by setting the Query property.
To execute the query, pass the
SPSiteDataQuery object to the GetSiteData(
SPSiteDataQuery) method, which returns a DataTable object containing rows of data that represent the result of the query. Each DataRow object in the DataTable. Rows collection represents the single item that satisfies the query. Each DataColumn object in the DataTable. Columns collection represents a field that is requested in the ViewFields property, and the column name equals the value of the Name attribute for that field. In addition, the data table contains a column named WebId, which identifies the Web site that contains each item, a column named ListId, which identifies the list that contains each item, and a column named ID, which identifies each item.
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Code :
Step 7:
Step 8:
Step 9:
Step 10:
Step 11:
Step 12:
Step 13:
Step 14:
Step 15:
Step 16:
SPLessonsLogo
Display a sharepoint list in another team site
Display a sharepoint list in another team site
Display a sharepoint list in another team site
Display a sharepoint list in another team site