|
1 |
| -# Provision SharePoint items with your solution package |
| 1 | +# Provision SharePoint assets with your solution package |
2 | 2 |
|
3 | 3 | At times, you may need to provision a SharePoint list or a document library along with your client-side solution package so that that list or library is available for your client-side components, such as web parts. SharePoint Framework toolchain allows you to package and deploy SharePoint items with your client-side solution package. These items are then provisioned when the client-side solution is installed on a site.
|
4 | 4 |
|
@@ -101,14 +101,35 @@ Below is an example of a list instance definition that uses a custom schema:
|
101 | 101 | And the custom schema definition that defines a content type for the list instance defined above:
|
102 | 102 |
|
103 | 103 | ```xml
|
104 |
| -<List xmlns:ows="Microsoft SharePoint" Title="Basic List" |
105 |
| - EnableContentTypes="TRUE" FolderCreation="FALSE" |
106 |
| - Direction="$Resources:Direction;" Url="Lists/Basic List" |
107 |
| - BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/"> |
| 104 | +<List xmlns:ows="Microsoft SharePoint" Title="Basic List" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Basic List" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/"> |
108 | 105 | <MetaData>
|
109 | 106 | <ContentTypes>
|
110 | 107 | <ContentTypeRef ID="0x010042D0C1C200A14B6887742B6344675C8B" />
|
111 |
| - </ContentTypes> |
| 108 | + </ContentTypes> |
| 109 | + <Fields></Fields> |
| 110 | + <Views> |
| 111 | + <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx"> |
| 112 | + <XslLink Default="TRUE">main.xsl</XslLink> |
| 113 | + <JSLink>clienttemplates.js</JSLink> |
| 114 | + <RowLimit Paged="TRUE">30</RowLimit> |
| 115 | + <Toolbar Type="Standard" /> |
| 116 | + <ViewFields> |
| 117 | + <FieldRef Name="LinkTitle"></FieldRef> |
| 118 | + <FieldRef Name="SPFxAmount"></FieldRef> |
| 119 | + <FieldRef Name="SPFxCostCenter"></FieldRef> |
| 120 | + </ViewFields> |
| 121 | + <Query> |
| 122 | + <OrderBy> |
| 123 | + <FieldRef Name="ID" /> |
| 124 | + </OrderBy> |
| 125 | + </Query> |
| 126 | + </View> |
| 127 | + </Views> |
| 128 | + <Forms> |
| 129 | + <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> |
| 130 | + <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> |
| 131 | + <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> |
| 132 | + </Forms> |
112 | 133 | </MetaData>
|
113 | 134 | </List>
|
114 | 135 | ```
|
@@ -175,31 +196,31 @@ Below is an example of an upgrade action file that applies an element manifest f
|
175 | 196 | In order to include the XML files, you will need to first define the feature configuration in the *package-solution.json* configuration file underneath the *config* folder in your project. The *package-solution.json* contains the key metadata information about your client-side solution package and is referenced when you run the `package-solution` gulp task which packages your solution into a `.sppkg` file.
|
176 | 197 |
|
177 | 198 | ```json
|
178 |
| -{ |
179 |
| - "solution": { |
180 |
| - "name": "hello-world-client-side-solution", |
181 |
| - "id": "26364618-3056-4b45-98c1-39450adc5723", |
182 |
| - "version": "1.1.0.0", |
183 |
| - "features": [{ |
184 |
| - "title": "hello-world-client-side-solution", |
185 |
| - "description": "hello-world-client-side-solution", |
186 |
| - "id": "d46cd9d6-87fc-473b-a4c0-db9ad9162b64", |
187 |
| - "assets": { |
188 |
| - "elementManifests": [ |
189 |
| - "elements.xml" |
190 |
| - ], |
191 |
| - "elementFiles":[ |
192 |
| - "schema.xml" |
| 199 | +{ |
| 200 | + "solution": { |
| 201 | + "name": "hello-world-client-side-solution", |
| 202 | + "id": "26364618-3056-4b45-98c1-39450adc5723", |
| 203 | + "version": "1.1.0.0", |
| 204 | + "features": [{ |
| 205 | + "title": "hello-world-client-side-solution", |
| 206 | + "description": "hello-world-client-side-solution", |
| 207 | + "id": "d46cd9d6-87fc-473b-a4c0-db9ad9162b64", |
| 208 | + "assets": { |
| 209 | + "elementManifests": [ |
| 210 | + "elements.xml" |
| 211 | + ], |
| 212 | + "elementFiles":[ |
| 213 | + "schema.xml" |
193 | 214 | ],
|
194 | 215 | "upgradeActions":[
|
195 | 216 | "upgrade-actions-v1.xml"
|
196 |
| - ] |
197 |
| - } |
198 |
| - }] |
199 |
| - }, |
200 |
| - "paths": { |
201 |
| - "zippedPackage": "solution/hello-world.sppkg" |
202 |
| - } |
| 217 | + ] |
| 218 | + } |
| 219 | + }] |
| 220 | + }, |
| 221 | + "paths": { |
| 222 | + "zippedPackage": "solution/hello-world.sppkg" |
| 223 | + } |
203 | 224 | }
|
204 | 225 | ```
|
205 | 226 | The `features` JSON object contains the metadata about the feature:
|
|
0 commit comments