Skip to content

Mapping Guide

Ilya Bystrov edited this page Mar 24, 2017 · 2 revisions

Mapping Guide

  1. Your entity class should implement ISharepointItem.
  2. Use attribute [SharepointList] to map your entity class to Sharepoint list. Set list name or guid.
  3. Use attribute [SharepointField] to map your property to Sharepoint item field. Set field Internal Name.
  4. For best results your property type should be compatible with Sharepoint field data type. But it is not necessary.
  5. To map Complex type, like FieldLookupValue or FieldUserValue, use MapData.LookupId and MapData.LookupValue. See below.
[SharepointList("Customers")]
public class SpProduct : ISharepointItem
{
    [SharepointField("ID")]
    public int Id { get; set; }

    [SharepointField("CustomerTitleEn")]
    public string Title { get; set; }

    [SharepointField("RankStatus")]
    public int? Rank { get; set; }

    [SharepointField("CustomerCreated")]
    public DateTime? Created { get; set; }

    [SharepointField("NumericInfo")]
    public double? SomeNumeric { get; set; }

    [SharepointField("YesNoColumn")]
    public bool? YesNoInfo { get; set; }

    [SharepointField("Author", MapData.LookupId)]
    public int AuthorId { get; set; }

    [SharepointField("Author", MapData.LookupValue)]
    public string Author { get; set; }
}
Clone this wiki locally