这是我迄今取得的成就:
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);