다음을 통해 공유


RelatedField Class

Specifies a relationship to a lookup field.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.RelatedField

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

Syntax

'Declaration
<ScriptTypeAttribute("SP.RelatedField", ServerTypeId := "{a91deb1a-2f24-4ac5-a1a6-3b1e530c307f}")> _
Public Class RelatedField _
    Inherits ClientObject
'Usage
Dim instance As RelatedField
[ScriptTypeAttribute("SP.RelatedField", ServerTypeId = "{a91deb1a-2f24-4ac5-a1a6-3b1e530c307f}")]
public class RelatedField : ClientObject

Examples

This code example displays the identifier of fields related to the Tasks list of the specified site.

using System;
using Microsoft.SharePoint.Client;

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

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            List targetList = site.Lists.GetByTitle("Tasks");

            // Get a collection of lookup fields that use this list as a data source 
            // and that have FieldLookup.IsRelationship set to true.
            RelatedFieldCollection collRelatedField = targetList.GetRelatedFields();

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

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

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

RelatedField Members

Microsoft.SharePoint.Client Namespace