0

I've written the below JSON to create a list (with the doc library template) and create an associated view.

{
            "verb": "createSPList",
            "listName": "Doc lib name",
            "templateType": 101,
            "subactions": [
                 {
                    "verb": "addSPView",
                    "name": "Documents View",
                    "viewFields":[
                        "DocIcon",
                        "Name",
                        "othercolumnshere..."
                    ],
                    "query": "<GroupBy Collapse=\"False\"> <FieldRef Name=\"ColumnNameHere\" /> </GroupBy>",
                    "rowLimit": 100,
                    "isPaged": true,
                    "makeDefault": false,
                    "scope": "Default"
                }

etc...
}

When I run the script through a site design, it's perfect and works fine. However, when I run the same script again for whatever reason, a new 'Name' column is appended at the end of the view. And when the script is run yet again, another one is added. This doesn't happen with any other column e.g

Run 1:
DocIcon | Name | Other Column

Run 2:
DocIcon | Name | Other Column | Name

Run 3:
DocIcon | Name | Other Column | Name | Name

If I don't include "Name" in "viewFields" the column doesn't show in the view at all.

I'm not entirely sure whether this is expected behaviour / I'm doing something wrong, or whether this is a bug. Any ideas?

0

You’d better share your full site design json,I did not reproduce your issue. enter image description here

enter image description here

My json:

$site_script = '
    {
        "$schema": "schema.json",
            "actions": [
                {
                    "verb": "createSPList",
                    "listName": "Customer Tracking",
                    "templateType": 100,
                    "subactions": [
                        {
                            "verb": "setDescription",
                            "description": "List of Customers and Orders"
                        },
                        {
                            "verb": "addSPField",
                            "fieldType": "Text",
                            "displayName": "Name",
                            "isRequired": false,
                            "addToDefaultView": true
                        },

                        {
                    "verb": "addSPView",
                    "name": "Documents View",
                    "viewFields":[
                        "Name"
                    ],
                    "query": "<GroupBy Collapse=\"False\"> <FieldRef Name=\"Name\" /> </GroupBy>",
                    "rowLimit": 100,
                    "isPaged": true,
                    "makeDefault": false,
                    "scope": "Default"
                }
                    ]
                }
            ],
                "bindata": { },
        "version": 1
    } '

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.