ListDataSource 類別
表示與外部資料來源連線相關聯的資訊。
繼承階層架構
System.Object
Microsoft.SharePoint.Client.ClientValueObject
Microsoft.SharePoint.Client.ListDataSource
命名空間: Microsoft.SharePoint.Client
組件: Microsoft.SharePoint.Client.Silverlight (在 Microsoft.SharePoint.Client.Silverlight.dll 中); Microsoft.SharePoint.Client.Phone (在 Microsoft.SharePoint.Client.Phone.dll 中) Microsoft.SharePoint.Client (在 Microsoft.SharePoint.Client.dll 中)
語法
'宣告
Public NotInheritable Class ListDataSource _
Inherits ClientValueObject
'用途
Dim instance As ListDataSource
public sealed class ListDataSource : ClientValueObject
備註
這個類別做為橋樑List和外部清單。使用相關聯的List擷取實體欄位和資料。
從 [ HasExternalDataSource ] 屬性中擷取ListDataSource的執行個體。HasExternalDataSource不是空值,就外部Microsoft SharePoint FoundationList物件的資料。
範例
此程式碼範例示範會列出在指定的網站上是外部項目。
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);
}
}
}
執行緒安全
這類型的任何公用 static (共用 於 Visual Basic 中) 成員是安全執行緒。不保證任何執行個體成員都是安全執行緒。