【问题标题】:CSOM Looking for a list of Columns / Fields that show up on SharePoint FormCSOM 寻找显示在 SharePoint 表单上的列/字段列表
【发布时间】: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


    【解决方案1】:

    根据 mt 测试,ShowInForm 的值在 field.SchemaXml 属性中。

    【讨论】:

    • 我的 field.SchemaXml 中没有该属性。我在 SharePoint 2013 上。这是我所拥有的:schemas.microsoft.com/sharepoint/v3\" StaticName= \"FileLeafRef\" Group=\"_Hidden\" ShowInFileDlg=\"FALSE\" ShowInVersionHistory=\"FALSE\" Type=\"File\" DisplayName=\"Name\" AuthoringInfo=\"(用于表单) \" List=\"Docs\" FieldRef=\"ID\" ShowField=\"LeafName\" JoinColName=\"DoclibRowId\" JoinRowOrdinal=\"0\" JoinType=\"INNER\" 必需=\"TRUE\ " 自定义=\"\" />"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-13
    • 2016-01-03
    • 2017-09-14
    • 1970-01-01
    • 1970-01-01
    • 2018-01-28
    相关资源
    最近更新 更多