You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/spfx/extensions/guidance/migrate-from-ecb-to-spfx-extensions.md
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,13 @@
1
+
---
2
+
title: Tutorial - Migrating from Edit Control Block (ECB) menu item to SharePoint Framework Extension
3
+
ms.date: 12/19/2017
4
+
ms.prod: sharepoint
5
+
---
6
+
1
7
# Migrating from Edit Control Block (ECB) menu item to SharePoint Framework Extensions
2
8
3
9
During the last few years, most of the enterprise solutions built on top of Office 365 and SharePoint Online leveraged the site _CustomAction_ capability of the SharePoint Feature Framework to extend the UI of pages. However nowdays, within the new "modern" UI of SharePoint Online, most of those customizations are no more available. Luckily, with the new SharePoint Framework Extensions you can provide similar functionality in the "modern" UI. In this tutorial you will learn how to migrate from old "classic" customizations to the new model based on SharePoint Framework Extensions.
4
10
5
-
> [!IMPORTANT]
6
-
> We're not deprecating the "classic" experience - both "classic" and "modern" will coexist.
7
-
8
-
_**Applies to:** SharePoint Online_
9
-
10
11
## Understanding SharePoint Framework Extensions
11
12
<aname="spfxExtensions"> </a>
12
13
First of all, let's introduce the available options when developing SharePoint Framework Extensions:
Copy file name to clipboardExpand all lines: docs/spfx/extensions/guidance/migrate-from-jslink-to-spfx-extensions.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
+
---
2
+
title: Tutorial - Migrating from JSLink to SharePoint Framework Extensions
3
+
ms.date: 12/19/2017
4
+
ms.prod: sharepoint
5
+
---
6
+
1
7
# Migrating from JSLink to SharePoint Framework Extensions
2
8
3
9
Since Microsoft SharePoint version 2013, most of the enterprise solutions built on top of Office 365 and SharePoint Online leveraged the _JSLink_ property of fields and list views to customize the rendering of fields. However nowdays, within the new "modern" UI of SharePoint Online, most of those customizations are no more available. Luckily, with the new SharePoint Framework Extensions you can now provide almost the same functionality in the "modern" UI. In this tutorial you will learn how to migrate from old "classic" customizations to the new model based on SharePoint Framework Extensions.
4
10
5
-
> [!IMPORTANT]
6
-
> We're not deprecating the "classic" experience - both "classic" and "modern" will coexist.
7
-
8
-
_**Applies to:** SharePoint Online_
9
-
10
11
## Understanding SharePoint Framework Extensions
11
-
<aname="spfxExtensions"> </a>
12
+
12
13
First of all, let's introduce the available options when developing SharePoint Framework Extensions:
13
14
14
15
***Application Customizer**: extend the native "modern" UI of SharePoint Online by adding custom HTML elements and client-side code to pre-defined placeholders of "modern" pages. At the time of this writing, the available placeholders are the header and the footer of every "modern" page.
@@ -21,7 +22,7 @@ As you can argue from the above descriptions, the most useful one in our context
21
22
> For further details about how to build SharePoint Framework Extensions you can read the article ["Overview of SharePoint Framework Extensions"](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/overview-extensions).
22
23
23
24
## Migrating a JSLink to an SPFx Field Customizer
24
-
<aname="FromJSLinktoFieldCustomizer"> </a>
25
+
25
26
Assume that you are in SharePoint Online, and you have a custom list with a custom field called "Color", which is of type _Choice_ and which can assume the following values: _Red_, _Green_, _Blue_, _Yellow_. Then, assume that you have custom value for the _JSLink_ property of the list view rendering web part of the custom list. In the following code snippet you can see the JavaScript code referenced by the _JSLink_ property (_customColorRendering.js_).
26
27
27
28
```JavaScript
@@ -100,7 +101,7 @@ As you can see "Color" fields render a colored box filled with the color selecte
100
101
In order to migrate the above solution to the SharePoint Framework, you will have to accomplish the following steps.
101
102
102
103
### Create a new SharePoint Framework solution
103
-
<aname="CreateFieldCustomizer"> </a>
104
+
104
105
Once you have prepared you development environment to develop SharePoint Framework solutions, by following the instructions provided in the document ["Set up your SharePoint client-side web part development environment"](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment), you can start creating a SharePoint Framework extension.
105
106
106
107
1. Open the command line tool of your choice (PowerShell, CMD.EXE, Cmder, etc.), create a new folder for the solution (call it _spfx-custom-field-extension_), and create a new SharePoint Framework solution by running the Yeoman generator with the following command:
@@ -140,7 +141,7 @@ code .
140
141
```
141
142
142
143
### Define the new Field Customizer with JavaScript
In order to reproduce the same behavior of the _JSLink_ custom field rendering, you simply need to implement the same logic using client-side code, within the new SharePoint Framework solution. To accomplish this task, complete the following steps.
145
146
146
147
1. First of all, open the file _CustomColorFieldFieldCustomizer.manifest.json_ under the _src/extensions/customColorField_ folder. Copy the value of the _id_ property and store it in a safe place, because you will need it later.
@@ -237,7 +238,7 @@ In the following figure you can see the resulting output.
237
238

238
239
239
240
### Test the solution in debug mode
240
-
<aname="DebugFieldCustomizer"> </a>
241
+
241
242
You are now ready to test your solution in debug mode.
242
243
243
244
1. Go back to the console window and run the following command:
@@ -259,7 +260,7 @@ In the above querystring, you will have to replace the GUID with the _id_ value
259
260
Notice that, when executing the page request, you will be prompted with a warning message box with title "Allow debug scripts?", which asks your consent to run code from localhost, for security reasons. Of course, if you want to locally debug and test the solution, you will have to allow to "Load debug scripts".
260
261
261
262
### Define the new Field Customizer with TypeScript
You are now ready to replace the JavaScript code with TypeScript, in order to benefit of the fully typed approach of TypeScript.
264
265
265
266
1. Open the file _CustomColorFieldFieldCustomizer.module.scss_ under the _src/extensions/customColorField_ folder. This file, which is a Sassy CSS, represents the UI style for the field customizer. Replace the content of the SCSS file with the following one.
@@ -341,7 +342,7 @@ Notice that the new method implementation uses a fully typed approach, and assig
341
342
3. Run one more time in debug mode the field customizer and see the result.
342
343
343
344
### Package and host the solution
344
-
<aname="PackageAndHostCommandSet"> </a>
345
+
345
346
If you are happy with the result, you are now ready to package the solution and host it in a real hosting infrastructure.
346
347
Before building the bundle and the package, you need to declare an XML feature framework file to provision the extension.
347
348
@@ -396,6 +397,7 @@ Now, open the _package-solution.json_ file under the _/config_ folder of the sol
396
397
```
397
398
398
399
#### Enable the CDN in your Office 365 tenant
400
+
399
401
Now you need to host the extension in a hosting environment. Office 365 CDN is the easiest way to host SharePoint Framework solutions directly from your tenant while still taking advantage of the Content Delivery Network (CDN) service for faster load times of your assets.
400
402
401
403
1. Download the [SharePoint Online Management Shell](https://www.microsoft.com/en-us/download/details.aspx?id=35588) to ensure that you have the latest version.
@@ -445,6 +447,7 @@ Note that your newly added origin is listed as a valid CDN origin. Final configu
445
447
When the origin is listed without the `(configuration pending)` text, it is ready to be used in your tenant. This indicates an on-going configuration between SharePoint Online and the CDN system.
446
448
447
449
#### Update the solution settings and publish it on the CDN
450
+
448
451
Now, you need to update the solution in order to use the just created CDN as the hosting enviroment and you will need to publish the solution bundle to the CDN. To accomplish this task, just follow the upcoming steps.
449
452
450
453
1. Return to the previously created solution to perform the needed URL updates.
@@ -478,7 +481,7 @@ Now, you need to update the solution in order to use the just created CDN as the
478
481
7. Upload or drag-and-drop the files in the _temp/deploy_ folder to the _CDN/customcolorfield_ folder created earlier.
479
482
480
483
### Install and run the solution
481
-
<a name="InstallFieldCustomizer"> </a>
484
+
482
485
You can now install the solution on any target "modern" site.
483
486
484
487
1. Open the browser and navigate to any target "modern" site.
Copy file name to clipboardExpand all lines: docs/spfx/extensions/guidance/migrate-from-usercustomactions-to-spfx-extensions.md
+15-12Lines changed: 15 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
+
---
2
+
title: Tutorial - Migrating from UserCustomAction to SharePoint Framework Extensions
3
+
ms.date: 12/19/2017
4
+
ms.prod: sharepoint
5
+
---
6
+
1
7
# Migrating from UserCustomAction to SharePoint Framework Extensions
2
8
3
9
During the last few years, most of the enterprise solutions built on top of Office 365 and SharePoint Online leveraged the site _CustomAction_ capability of the SharePoint Feature Framework to extend the UI of pages. However nowdays, within the new "modern" UI of SharePoint Online, most of those customizations are no more available. Luckily, with the new SharePoint Framework Extensions you can now provide almost the same functionality in the "modern" UI. In this tutorial you will learn how to migrate from old "classic" customizations to the new model based on SharePoint Framework Extensions.
4
10
5
-
> [!IMPORTANT]
6
-
> We're not deprecating the "classic" experience - both "classic" and "modern" will coexist.
7
-
8
-
_**Applies to:** SharePoint Online_
9
-
10
11
## Understanding SharePoint Framework Extensions
11
-
<aname="spfxExtensions"> </a>
12
+
12
13
First of all, let's introduce the available options when developing SharePoint Framework Extensions:
13
14
14
15
***Application Customizer**: extend the native "modern" UI of SharePoint Online by adding custom HTML elements and client-side code to pre-defined placeholders of "modern" pages. At the time of this writing, the available placeholders are the header and the footer of every "modern" page.
@@ -21,7 +22,7 @@ As you can argue from the above descriptions, the most useful one in our context
21
22
> For further details about how to build SharePoint Framework Extensions you can read the article ["Overview of SharePoint Framework Extensions"](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/overview-extensions).
22
23
23
24
## Migrating a UserCustomAction to an SPFx Application Customizer
Assume that you have a _CustomAction_ in SharePoint Online, in order to have a custom footer in all of the site's pages.
26
27
In the following code snippet you can see the XML code defining that _CustomAction_ using the SharePoint Feature Framework.
27
28
@@ -141,7 +142,7 @@ In the following figure you can see the output of the previous custom action, wi
141
142
In order to migrate the above solution to the "modern" UI, you will have to accomplish the following steps.
142
143
143
144
### Create a new SharePoint Framework solution
144
-
<aname="CreateApplicationCustomizer"> </a>
145
+
145
146
Once you have prepared you development environment to develop SharePoint Framework solutions, by following the instructions provided in the document ["Set up your SharePoint client-side web part development environment"](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment), you can start creating a SharePoint Framework extension.
146
147
147
148
1. Open the command line tool of your choice (PowerShell, CMD.EXE, Cmder, etc.), create a new folder for the solution (call it _spfx-react-custom-footer_), and create a new SharePoint Framework solution by running the Yeoman generator with the following command:
@@ -180,7 +181,7 @@ code .
180
181
```
181
182
182
183
### Define the new UI elements
183
-
<aname="DefineApplicationCustomizerUI"> </a>
184
+
184
185
The UI elements of the custom footer will be rendered using React and a custom React component. Of course, you can create the UI elements of the sample footer with whatever technology you like. In this tutorial, we use React in order to leverage the Office UI Fabric components for React.
185
186
186
187
> [!NOTE]
@@ -328,7 +329,7 @@ In the following figure you can see the resulting output.
328
329

329
330
330
331
### Test the solution in debug mode
331
-
<aname="DebugApplicationCustomizer"> </a>
332
+
332
333
You are now ready to test your solution in debug mode.
333
334
334
335
1. Go back to the console window and run the following command:
@@ -348,11 +349,12 @@ The above command will build the solution and run the local Node.js server to ho
348
349
In the above querystring, you will have to replace the GUID with the _id_ value you saved from the _CustomFooterApplicationCustomizer.manifest.json_ file. Notice that, when executing the page request, you will be prompted with a warning message box with title "Allow debug scripts?", which asks your consent to run code from localhost, for security reasons. Of course, if you want to locally debug and test the solution, you will have to allow to "Load debug scripts".
If you are happy with the result, you are now ready to package the solution and host it in a real hosting infrastructure.
353
354
Before building the bundle and the package, you need to declare an XML feature framework file to provision the extension.
354
355
355
356
#### Review feature framework elements
357
+
356
358
Within the code editor, open the _/sharepoint/assets_ sub-folder of the solution folder and edit the _elements.xml_ file.
357
359
In the following code excerpt you can see how the file should look like.
358
360
@@ -448,6 +450,7 @@ Note that your newly added origin is listed as a valid CDN origin. Final configu
448
450
When the origin is listed without the `(configuration pending)` text, it is ready to be used in your tenant. This indicates an on-going configuration between SharePoint Online and the CDN system.
449
451
450
452
#### Update the solution settings and publish it on the CDN
453
+
451
454
Now, you need to update the solution in order to use the just created CDN as the hosting enviroment and you will need to publish the solution bundle to the CDN. To accomplish this task, just follow the upcoming steps.
452
455
453
456
1. Return to the previously created solution to perform the needed URL updates.
@@ -481,7 +484,7 @@ Now, you need to update the solution in order to use the just created CDN as the
481
484
7. Upload or drag-and-drop the files in the _temp/deploy_ folder to the _CDN/customfooter_ folder created earlier.
482
485
483
486
### Install and run the solution
484
-
<a name="InstallApplicationCustomizer"> </a>
487
+
485
488
You can now install the solution on any target "modern" site.
486
489
487
490
1. Open the browser and navigate to any target "modern" site.
0 commit comments