List.GetRelatedFields 方法
Returns a collection of lookup fields that use this list as a data source and that have FieldLookup.IsRelationship set to 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
Returns a RelatedFieldCollection instance representing the collection of lookup fields that use this list as a data source and that have FieldLookup.IsRelationship set to true.
异常
异常 | 条件 |
---|---|
[System.UnauthorizedAccessException] | The current user has insufficient permissions. Error code: -2147024891. |
示例
This code example displays the identifier of any fields related to the current site’s Tasks list.
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);
}
}
}
}