Skip to content

Commit 72bee8e

Browse files
authored
Adds information on the id parameters to create field actions
1 parent 32c934d commit 72bee8e

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

docs/declarative-customization/site-design-json-schema.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ The overall JSON structure is specified as follows:
1414
```json
1515
{
1616
"$schema": "schema.json",
17-
"actions": [
18-
...
19-
<one or more verb actions>
20-
...
21-
],
22-
"bindata": { },
23-
"version": 1
17+
"actions": [
18+
...
19+
<one or more verb actions>
20+
...
21+
],
22+
"bindata": { },
23+
"version": 1
2424
};
2525
```
2626

@@ -34,7 +34,7 @@ You can view - and reference - the latest schema here: https://developer.microso
3434
Use the **createSPList** verb to create a new SharePoint list.
3535

3636
> [!NOTE]
37-
> Once **createSPList** is applied on a site, runnning the **createSPList** with the same list name will act as an update to the existing list.
37+
> Once **createSPList** is applied on a site, runnning the **createSPList** with the same list name will act as an update to the existing list.
3838
3939
#### JSON values
4040

@@ -90,23 +90,6 @@ Use the **createSPList** verb to create a new SharePoint list.
9090

9191
The subactions array provides additional actions to specify how to construct the list. Subactions are also specified using a **verb** value.
9292

93-
### setTitle
94-
95-
Sets a title which identifies the list in views.
96-
97-
#### JSON value
98-
99-
- **title** &ndash; The title of the new list.
100-
101-
#### Example
102-
103-
```json
104-
{
105-
"verb": "setTitle",
106-
"title": "Customers and Orders"
107-
}
108-
```
109-
11093
### setDescription
11194

11295
Sets the description of the list.
@@ -132,6 +115,7 @@ Adds a new field.
132115

133116
- **fieldType** &ndash; The field type can be set to **Text**, **Note**, **Number**, **Boolean**, **User**, or **DateTime**. For other data types, see the addSPFieldXml action.
134117
- **displayName** &ndash; The display name of the field.
118+
- **id** &ndash; An optional attribute. If provided, specifies the id of the field. It needs to be a unique, randomly generated GUID. Providing a value for this is strongly recommended to ensure the field is not added multiple times if the script is re-run.
135119
- **internalName** &ndash; An optional attribute. If provided, specifies the internal name of the field. If not provided, the internal name is based on the display name.
136120
- **isRequired** &ndash; **True** if this field is required to contain information; otherwise, **false**.
137121
- **addToDefaultView** &ndash; **True** if the field will be added to the default view; otherwise, **false**.
@@ -145,6 +129,7 @@ Adds a new field.
145129
"fieldType": "Text",
146130
"displayName": "Customer Name",
147131
"isRequired": false,
132+
"id": "c532fcb9-cdb3-45c6-8247-c784dcd58e1a"
148133
"addToDefaultView": true
149134
}
150135
```
@@ -168,7 +153,7 @@ Deletes a default field that was provided by the selected template type.
168153

169154
### addSPFieldXml
170155

171-
Enables defining fields and their elements using Collaborative Application Markup Language (CAML). For reference, see [Field element (Field)](https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field).
156+
Enables defining fields and their elements using Collaborative Application Markup Language (CAML). For reference, see [Field element (Field)](https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field). Note that providing the ID attribute in the field schemaXml is very important in order to prevent the field from being created multiple times if the script is run more than once.
172157

173158
Currently these field constructs cannot be designated as site columns nor added to content types. To create site columns with Field XML use the **createSiteColumnXml** action.
174159

@@ -182,13 +167,13 @@ Currently these field constructs cannot be designated as site columns nor added
182167
```json
183168
{
184169
"verb": "addSPFieldXml",
185-
"schemaXml": "<Field Type=\"Choice\" DisplayName=\"Project Category\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"ProjectCategory\" Name=\"ProjectCategory\"><Default>Operations</Default><CHOICES><CHOICE>Operations</CHOICE><CHOICE>IT</CHOICE><CHOICE>Legal</CHOICE><CHOICE>Engineering</CHOICE></CHOICES></Field>"
170+
"schemaXml": "<Field ID=\"{596cbd92-36e3-40cc-a910-0f53468ce5e4}\" Type=\"Choice\" DisplayName=\"Project Category\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"ProjectCategory\" Name=\"ProjectCategory\"><Default>Operations</Default><CHOICES><CHOICE>Operations</CHOICE><CHOICE>IT</CHOICE><CHOICE>Legal</CHOICE><CHOICE>Engineering</CHOICE></CHOICES></Field>"
186171
}
187172
```
188173

189174
### addSPLookupFieldXml
190175

191-
Enables defining lookup fields and their dependent lists element using Collaborative Application Markup Language (CAML). For reference, see [Field element (Field)](https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field).
176+
Enables defining lookup fields and their dependent lists element using Collaborative Application Markup Language (CAML). For reference, see [Field element (Field)](https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field). Note that providing the ID attribute in the field schemaXml is very important in order to prevent the field from being created multiple times if the script is run more than once.
192177

193178
#### JSON value
194179

@@ -475,6 +460,23 @@ Associates a ListViewCommandSet to the list
475460
}
476461
```
477462

463+
### setTitle
464+
465+
Sets a title which identifies the list in views.
466+
467+
#### JSON value
468+
469+
- **title** &ndash; The title of the new list.
470+
471+
#### Example
472+
473+
```json
474+
{
475+
"verb": "setTitle",
476+
"title": "Customers and Orders"
477+
}
478+
```
479+
478480
## Define a new site column
479481

480482
Use the **createSiteColumn** verb to define a new site column that can then be associated to a list directly or by using the addContentType action.
@@ -485,6 +487,7 @@ Use the **createSiteColumn** verb to define a new site column that can then be a
485487
- **internalName** &ndash; The internal name of the site column.
486488
- **displayName** &ndash; The display name of the site column.
487489
- **isRequired** &ndash; **True** if this field is required to contain information; otherwise, **false**.
490+
- **id** &ndash; An optional attribute. If provided, specifies the id of the field. It needs to be a unique, randomly generated GUID. Providing a value for this is strongly recommended to ensure the field is not added multiple times if the script is re-run.
488491
- **group** &ndash; An optional attribute to designate the column group.
489492
- **enforceUnique** &ndash; An optional attribute that defaults to **false**. If **true**, all values for this field must be unique.
490493

@@ -496,11 +499,12 @@ Use the **createSiteColumn** verb to define a new site column that can then be a
496499
"fieldType": "User",
497500
"internalName": "siteColumn4User",
498501
"displayName": "Project Owner",
499-
"isRequired": false
502+
"isRequired": false,
503+
"id": "181c4370-cdae-471b-9499-730046e55b75"
500504
}
501505
```
502506

503-
Use the **createSiteColumnXml** verb to define a new site column for those complex data types not supported by createSiteColumn. These columns can then be associated to a list directly or by using the addContentType action.
507+
Use the **createSiteColumnXml** verb to define a new site column for those complex data types not supported by createSiteColumn. These columns can then be associated to a list directly or by using the addContentType action. Note that providing the ID attribute in the field schemaXml is very important in order to prevent the field from being created multiple times if the script is run more than once.
504508

505509
#### JSON value
506510

@@ -512,7 +516,7 @@ Use the **createSiteColumnXml** verb to define a new site column for those compl
512516
```json
513517
{
514518
"verb": "createSiteColumnXml",
515-
"schemaXml": "<Field Type=\"Choice\" DisplayName=\"Project Status\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"ProjectStatus\" Name=\"ProjectStatus\"><Default>In Progress</Default><CHOICES><CHOICE>In Progress</CHOICE><CHOICE>In Review</CHOICE><CHOICE>Done</CHOICE><CHOICE>Has Issues</CHOICE></CHOICES></Field>"
519+
"schemaXml": "<Field ID=\"{82581bd1-356f-4206-8ff7-a3b6ad1f5553}\" Type=\"Choice\" DisplayName=\"Project Status\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"ProjectStatus\" Name=\"ProjectStatus\"><Default>In Progress</Default><CHOICES><CHOICE>In Progress</CHOICE><CHOICE>In Review</CHOICE><CHOICE>Done</CHOICE><CHOICE>Has Issues</CHOICE></CHOICES></Field>"
516520
}
517521
```
518522

0 commit comments

Comments
 (0)