【问题标题】:How to set up a lookup Field xml field creation in SharePoint Online in JSON如何在 SharePoint Online 中以 JSON 格式设置查找字段 xml 字段创建
【发布时间】:2022-10-24 05:18:47
【问题描述】:

我想在 SharePoint Online 的模板脚本中提供一个带有查找字段的列表。 其中之一是“参与者名单”。在这个列表中,我想创建一个查找字段,它应该引用另一个列表中的“角色描述”字段。我不知道从哪里获得目标字段的 ID 以及如何正确构建 XML。

到目前为止,这是我的 JSON:

{
        "verb": "createSPList",
        "listName": "Project Participants interal and external",
        "templateType": 100,
        "subactions": [
            {
                "verb": "setDescription",
                "description": "Participants who will be in the project"
            },
            {
                "verb": "addSPLookupFieldXml",
                "schemaXml": "<Field Type=\"Lookup\" DisplayName=\"Role Description\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" ShowField=\"Title\" UnlimitedLengthInDocumentLibrary=\"FALSE\" RelationshipDeleteBehavior=\"None\" ID=\"{?????} StaticName=\"ProjectRoles\" Name=\"ProjectRoles\" />",
                "targetListName": "Role Description",
                "addToDefaultView": true
            }
        ]
    }



 {
        "verb": "createSPList",
        "listName": "Role Description",
        "templateType": 100,
        "subactions": [
            {
                "verb": "setDescription",
                "description": "All description of the roles will be stored here"
            }
        ]
    }

如果我先创建列表,我会在哪里获得字段的 ID。再次使用时 ID 会发生变化。

我希望你能帮助我解决这个问题。

此致

马蒂亚斯

【问题讨论】:

    标签: json templates sharepoint-online


    【解决方案1】:

    您不需要获取目标字段的 ID。您可以使用 ShowField 显示目标列表中的列。

    {
                "verb": "addSPLookupFieldXml",
                "schemaXml": "<Field Type="Lookup" DisplayName="Role Description" Required="FALSE" EnforceUniqueValues="FALSE" ShowField="{Here you can use name of the column you want to show from Role Description}" UnlimitedLengthInDocumentLibrary="FALSE" RelationshipDeleteBehavior="None" ID="{This is the Id of this column} StaticName="ProjectRoles" Name="ProjectRoles" />",
                "targetListName": "Role Description",
                "addToDefaultView": true
            }
    

    【讨论】:

    • 如果回答对您有帮助,请点击回答左侧面板上的“√”并点赞。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-11
    • 2021-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多