ListDataSource class
SharePoint Online
Represents information associated with a connection to an external data source.
System.Object
Microsoft.SharePoint.Client.ClientValueObject
Microsoft.SharePoint.Client.ListDataSource
Microsoft.SharePoint.Client.ClientValueObject
Microsoft.SharePoint.Client.ListDataSource
Namespace: Microsoft.SharePoint.Client
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
This class serves as the bridge between List and an external list. Use the associated List to retrieve entity fields and data.
Retrieve an instance of ListDataSource from the HasExternalDataSource property. When HasExternalDataSource is not null, the List object's data is external to Microsoft SharePoint Foundation.
This code example shows which lists on the specified site are external.
using System; using Microsoft.SharePoint.Client; namespace Microsoft.SDK.SharePointFoundation.Samples { class ListDataSourceExample { static void Main() { string siteUrl = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(siteUrl); Web site = clientContext.Web; clientContext.Load(site); ListCollection collList = site.Lists; clientContext.Load( collList, lists => lists .Include( list => list.Title, list => list.DataSource) ); clientContext.ExecuteQuery(); string messageExternal = "External Lists:\n"; string messageNormal = "Normal Lists:\n"; foreach (List targetList in collList) if (targetList.DataSource != null) { // Get connection properties of the ListDataSource object. messageExternal += "\n\t" + targetList.Title + "(Entity=" + targetList.DataSource.Properties["Entity"] + "; " + "LOB System=" + targetList.DataSource.Properties["LobSystemInstance"]; } else { messageNormal += "\n\t" + targetList.Title; } Console.WriteLine(messageExternal); Console.WriteLine(messageNormal); } } }
Show: