共用方式為


List.GetRelatedFields 方法

傳回的查閱欄位,做為資料來源使用此清單,以及有 FieldLookup.IsRelationship 設定為 [ true集合。

命名空間:  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 Function GetRelatedFields As RelatedFieldCollection
'用途
Dim instance As List
Dim returnValue As RelatedFieldCollection

returnValue = instance.GetRelatedFields()
public RelatedFieldCollection GetRelatedFields()

傳回值

類型:Microsoft.SharePoint.Client.RelatedFieldCollection
傳回代表的查閱欄位,做為資料來源使用此清單,以及有 FieldLookup.IsRelationship 設定為 [ true集合RelatedFieldCollection執行個體。

例外狀況

例外狀況 條件
[System.UnauthorizedAccessException]

目前的使用者會有足夠的權限。錯誤碼 ︰-2147024891。

範例

此範例中的程式碼會顯示到目前網站的 [工作] 清單中相關的任何欄位的識別碼。

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class List_getRelatedFieldsExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            List targetList = site.Lists.GetByTitle("Tasks");
            RelatedFieldCollection collRelatedField = targetList.GetRelatedFields();

            clientContext.Load(collRelatedField);
            clientContext.ExecuteQuery();

            foreach (RelatedField targetField in collRelatedField)
               Console.WriteLine("Related Field ID: {0}", targetField.FieldId);
            }
        }
    }
}

請參閱

參照

List 類別

List 成員

Microsoft.SharePoint.Client 命名空間