public static LookupFieldDefinition CommercialActId = new LookupFieldDefinition
{
Id = new Guid("AB46B41A-B635-4319-B6F7-5D5B5BA9C9A0"),
Title = "Коммерческий акт",
InternalName = "tsk_CommercialActId",
Group = "Bpm.Project.CommercialAct",
ShowInNewForm = false,
ShowInEditForm = false,
Required = true
// ВАЖНО! связывание со списком делается позже, а не при орбъявлении
// LookupListTitle = SharePoint.Lists.CommercialAct.ListCommercialAct.Title
};
В таком виде поле добавляется на сайт Site Scope
siteDefenition.AddContentType(SharePoint.ContentTypes.CommentsHistory.CommentsHistoryContentType,contentType =>
{
contentType.AddContentTypeFieldLink(SharePoint.Fields.CommentsHistory.CommercialActId)
});
Далее контент попадает в список, список на наш узел. Web Scope
web.AddList(SharePoint.Lists.CommentsHistory.ListCommentsHistory, listDefinition =>
{
listDefinition
.AddContentTypeLink(SharePoint.ContentTypes.CommentsHistory.CommentsHistoryContentType);
});
/*deploy*/
var ssomProvisionService = new SSOMProvisionService();
ssomProvisionService.DeployWebModel(spWeb, modelWeb);
Вот тут идет обновление связей lookupField
var lookupFieldModel = SPMeta2Model.NewSiteModel(site =>
{
site.AddField(SharePoint.Fields.CommentsHistory.CommercialActId);
});
SharePoint.Fields.CommentsHistory.CommercialActId.LookupListTitle = SharePoint.Lists.CommercialAct.ListCommercialAct.Title;
/*deploy*/
ssomProvisionService.DeploySiteModel(spWeb.Site, lookupFieldModel);