Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ListDataSource class

Represents information associated with a connection to an external data source.


Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client.Phone (in Microsoft.SharePoint.Client.Phone.dll)  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

public sealed class ListDataSource : ClientValueObject

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;
            ListCollection collList = site.Lists;
               lists => lists
                     list => list.Title,
                     list => list.DataSource)

            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"];
                  messageNormal += "\n\t" + targetList.Title;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft