Condividi tramite


ColumnAttribute.IsLookupId Property

Gets or sets a value that indicates whether the property represents the Id of the list item that provides the value for the property that represents the looked-up value.

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

Syntax

'Declaration
Public Property IsLookupId As Boolean
    Get
    Set
'Usage
Dim instance As ColumnAttribute
Dim value As Boolean

value = instance.IsLookupId

instance.IsLookupId = value
public bool IsLookupId { get; set; }

Property Value

Type: System.Boolean
true, if the property represents the Id of the same item in the lookup target list that provides the value for the Lookup field; false otherwise.

Remarks

For example, a Team Members list has a Manager column that is a lookup field to a Managers list. The property representing the Manager column has a ColumnAttribute with IsLookupValue set to true. But there is also a ManagerID property that is decorated with a ColumnAttribute (even if there is no ManagerID column in the content type) with the IsLookupId set to true.

Examples

The following example shows IsLookupId and IsLookupValue in use:

[ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {
{
    [DataMember()]
    private LookupList<System.Nullable<int>> _managerId;
    
    [DataMember()]
    private LookupList<string> _managerTitle

    [Column(Name="Manager", Storage="_managerId", FieldType="User", IsLookupId=true, LookupDisplayColumn="Title")]
    public IList<System.Nullable<int>> ManagerId {
          get {
              return this._managerId;
          }
          set {
              this._managerId.Assign(value);
          }
     }
      
      [Column(Name="Manager", Storage="_managerTitle", ReadOnly=true, FieldType="User", IsLookupValue=true, LookupDisplayColumn="Title")]
      public IList<string> ManagerTitle {
          get {
              return this._managerTitle;
          }
          set {
              this._managerTitle.Assign(value);
          }
      }
      
      // Other members omitted for readability.
}

See Also

Reference

ColumnAttribute Class

ColumnAttribute Members

Microsoft.SharePoint.Linq Namespace