在Sharepoint Client Model中为列表添加查找字段

时间:2015-02-16 13:24:50

标签: sharepoint csom

这是我迄今取得的成就:

                        Field parent = list.Fields.AddFieldAsXml(
                       @"<Field Type='Lookup' DisplayName='ParentContentType' 
                                Required='FALSE' EnforceUniqueValues='FALSE'
                                List= 'ContentTypes'
                                ShowField='Title' UnlimitedLengthInDocumentLibrary='FALSE' 
                                RelationshipDeleteBehavior='None' 
                                StaticName='ParentContentType' Name='ParentContentType'/>",
                   true, AddFieldOptions.DefaultValue);

但我无法为此查询字段设置获取信息:值。

有人可以建议如何实现它吗?

已添加代码:

var listCreationInfo = new ListCreationInformation();
listCreationInfo.Title = "New List";
listCreationInfo.TemplateType = (int)ListTemplateType.CustomGrid;
List list = web.Lists.Add(listCreationInfo);
list.Update();
ctxt.ExecuteQuery();
Field parent = list.Fields.AddFieldAsXml(
    @"<Field Type='Lookup' DisplayName='ParentContentType' 
    Required='FALSE' EnforceUniqueValues='FALSE'
    List= 'ContentTypes'
    ShowField='Title' UnlimitedLengthInDocumentLibrary='FALSE' 
    RelationshipDeleteBehavior='None' 
    StaticName='ParentContentType' Name='ParentContentType'/>",
    true, AddFieldOptions.DefaultValue);

0 个答案:

没有答案