次の方法で共有


ListDataSource class

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

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientValueObject
    Microsoft.SharePoint.Client.ListDataSource

Namespace:  Microsoft.SharePoint.Client
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
Public NotInheritable Class ListDataSource _
    Inherits ClientValueObject
'Usage
Dim instance As ListDataSource
public sealed class ListDataSource : ClientValueObject

Remarks

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.

Examples

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);
        }
    }
}

Thread safety

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

See also

Reference

ListDataSource members

Microsoft.SharePoint.Client namespace