【发布时间】:2021-07-17 03:47:45
【问题描述】:
我想获取内容类型的字段列表。我希望获得仅显示在已上传文档的“编辑表单”或“编辑属性”上的字段列表。
下面的代码将为我提供字段列表,但我无法区分编辑表单/显示表单上刚刚显示的字段。
我想我需要查看 FieldLink Collection,因为它应该有一个 ShowInForm 属性。但“ShowInForm”在该集合中不是有效属性。
我也做了一些谷歌搜索,但我可以看到如何 setShowInForm,但看不到如何获取该字段的值。
如果您有任何建议,请告诉我。
ClientContext clientContext = new ClientContext(site);
//// Get the content type using ID: 0x01003D7B5A54BF843D4381F54AB9D229F98A - is the ID of the "Custom" content Type
string contentTypeID = GetContentTypeGUID(contentType, site);
ContentType ct = clientContext.Web.ContentTypes.GetById(contentTypeID);
//// Gets a value that specifies the collection of fields for the content type
FieldCollection fieldColl = ct.Fields;
clientContext.Load(fieldColl);
clientContext.ExecuteQuery();
//// Display the field name
foreach (Field oField in fieldColl)
{
// Code for each Field
}
【问题讨论】:
标签: c# sharepoint properties content-type csom