Skip to content

Commit 2c96e39

Browse files
committed
Merge branch 'staging'
2 parents bb77e1f + 083354e commit 2c96e39

7 files changed

+65
-64
lines changed
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
# Build your first SharePoint Framework Extension (Hello World part 1)
33

4-
>**Note:** The SharePoint Framework Extensions are currently in preview and is subject to change. SharePoint Framework Extensions are not currently supported for use in production environments.
4+
>**Note:** The SharePoint Framework Extensions are currently in preview and are subject to change. SharePoint Framework Extensions are not currently supported for use in production environments.
55
66
Extensions are client-side components that run inside the context of a SharePoint page. Extensions can be deployed to SharePoint Online, and you can also use modern JavaScript tools and libraries to build them.
77

88
>**Note:** Before following the steps in this article, be sure to [Set up your development environment](../../set-up-your-development-environment). Notice that extensions are currently **ONLY** available from Office 365 developer tenants.
99
10-
## Create a extension project
10+
## Create an extension project
1111
Create a new project directory in your favorite ___location.
1212

1313
```
@@ -28,14 +28,14 @@ yo @microsoft/sharepoint
2828

2929
When prompted:
3030

31-
* Accept the default **app-extension** as your solution name and choose **Enter**.
32-
* Choose **Extension (Preview)** as client-side component type to be created.
33-
* Choose **Application Customizer (Preview)** as they extension type to be created.
31+
* Accept the default **app-extension** as your solution name and press **Enter**.
32+
* Choose **Extension (Preview)** as the client-side component type to be created.
33+
* Choose **Application Customizer (Preview)** as the extension type to be created.
3434

3535
The next set of prompts will ask for specific information about your extension:
3636

37-
* Accept the default **HelloWorld** as your extension name and choose **Enter**.
38-
* Accept the default **HelloWorld description** as your extension description and choose **Enter**.
37+
* Accept the default **HelloWorld** as your extension name and press **Enter**.
38+
* Accept the default **HelloWorld description** as your extension description and press **Enter**.
3939

4040
![Yeoman SharePoint generator prompts to create an extension solution](../../../../images/ext-yeoman-app-prompts.png)
4141

@@ -47,21 +47,21 @@ When the scaffold is complete, you should see the following message indicating a
4747

4848
For information about troubleshooting any errors, see [Known issues](../basics/known-issues).
4949

50-
Once solution scaffolding is completed, type the following into console to start Visual Studio Code.
50+
Once solution scaffolding is completed, type the following into the console to start Visual Studio Code.
5151

5252
```
5353
code .
5454
```
5555

5656
> Notice that because the SharePoint client-side solution is HTML/TypeScript based, you can use any code editor that supports client-side development to build your extension.
5757
58-
Notice how the default solution structure is like the solution structure of client-side web parts. This is the basic SharePoint Framework solution structure, with similar configuration options across all solution types.
58+
Notice how the default solution structure is like the solution structure of client-side web parts. This is the basic SharePoint Framework solution structure, with similar configuration options across all solution types.
5959

6060
![SharePoint Framework solution opened after initial scaffolding](../../../../images/ext-app-vscode-solution-structure.png)
6161

6262
Open **HelloWorldApplicationCustomizer.manifest.json** at the src\extensions\helloWorld folder.
6363

64-
This file defines your extension type and a unique identifier **“id”** for your extension. You’ll need this unique identifier later when debugging and deploying your extension to SharePoint.
64+
This file defines your extension type and a unique identifier **“id”** for your extension. You’ll need this unique identifier later when debugging and deploying your extension to SharePoint.
6565

6666
![Application customizer manifest json content](../../../../images/ext-app-vscode-manifest.png)
6767

@@ -72,71 +72,71 @@ Notice that base class for the Application Customizer is imported from the **sp-
7272

7373
![import statement for BaseApplicationCustomizer from @microsoft/sp-application-base](../../../../images/ext-app-vscode-app-base.png)
7474

75-
The logic for your Application Customizer is contained in the two methods onInit and onRender.
75+
The logic for your Application Customizer is contained in the two methods **onInit** and **onRender**.
7676

77-
- **onInit()** is where you should perform any setup needed for your extension. This event occurs after this.context and this.properties are assigned, but before the page DOM is ready. Like with web parts, onInit() returns a promise that you can use to perform asynchronous operations; onRender() will not be called until your promise has resolved. If you don’t need that, simply return super.onInit().
78-
- **onRender()** is where your extension can interact with the UI. This event occurs after the application’s initial page DOM structure has been created (although some parts of the UI may not have finished rendering yet).
77+
- **onInit()** is where you should perform any setup needed for your extension. This event occurs after ```this.context``` and ```this.properties``` are assigned, but before the page DOM is ready. As with web parts, ```onInit()``` returns a promise that you can use to perform asynchronous operations; ```onRender()``` will not be called until your promise has resolved. If you don’t need that, simply return ```super.onInit()```.
78+
- **onRender()** is where your extension can interact with the UI. This event occurs after the application’s initial page DOM structure has been created (although some parts of the UI may not have finished rendering yet).
7979

80-
> Notice. The class constructor is called at an early stage, when "this.context" and "this.properties" are undefined. We do not support including custom initiation logic here.
80+
> Notice. The class constructor is called at an early stage, when ```this.context``` and ```this.properties``` are undefined. We do not support including custom initiation logic here.
8181
82-
Below are the contents of **onInit()** and **onRender()** in the default solution. This default solution simply writes a log to the Dev Dashboard, and then displays a simple JavaScript alert when the page renders.
82+
Below are the contents of **onInit()** and **onRender()** in the default solution. This default solution simply writes a log to the Dev Dashboard, and then displays a simple JavaScript alert when the page renders.
8383

8484
![default onInit and onRender methods in the code](../../../../images/ext-app-vscode-methods.png)
8585

86-
> If your application customizer uses the ClientSideComponentProperties JSON input, it will be deserialized into the BaseExtension.properties object. You can define an interface to describe it. Default template is looking for property called testMessage and is outputting that in alert message, if it's provided.
86+
> If your application customizer uses the ClientSideComponentProperties JSON input, it will be deserialized into the BaseExtension.properties object. You can define an interface to describe it. The default template is looking for a property called testMessage, and if it's provided, outputting it in an alert message.
8787
8888
## Debugging your Application Customizer using gulp serve and query string parameters
89-
SharePoint Framework extensions cannot be currently tested just by using local workbench, so you'll need to test and develop them directly against live SharePoint Online site. You do not however need to deploy your customization to app catalog, to be able to do this, which will keep the debugging experience simple and efficient.
90-
91-
First, compile your code and host the compiled files from the local machine by running this command:
89+
SharePoint Framework extensions cannot currently be tested using the local workbench, so you'll need to test and develop them directly against a live SharePoint Online site. You do not, however, need to deploy your customization to the app catalog to do this, which keeps the debugging experience simple and efficient.
9290

91+
First, compile your code and host the compiled files from your local machine by running this command:
9392
```
9493
gulp serve --nobrowser
9594
```
96-
Notice that we used the `--nobrowser` option, since there's no value for starting local workbench, since you cannot debug extensions locally currently.
95+
96+
Notice that we used the ```--nobrowser``` option, since there's no value in launching the local workbench since you currently cannot debug extensions locally.
9797

9898
Once it compiles the code without errors, it will serve the resulting manifest from http://localhost:4321.
9999

100100
![gulp serve](../../../../images/ext-app-gulp-serve.png)
101101

102102
To test your extension, navigate to a modern list view page in your SharePoint environment and append the following query string parameters to the URL:
103-
104103
```
105104
?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js&customActions={"d03ae0c2-bbbf-4cf5-9ff7-0986904553da":{"___location":"ClientSideExtension.ApplicationCustomizer","properties":{"testMessage":"Hello as property!"}}}
106105
```
106+
107107
More detail about the URL query parameters:
108108

109-
* **loadSPFX=true:** ensures that the SharePoint Framework is loaded on the page. For performance reasons, the framework normally is not loaded unless at least one extension is registered. Since no components are registered yet, we must explicitly load the framework.
109+
* **loadSPFX=true:** ensures that the SharePoint Framework is loaded on the page. For performance reasons, the framework is not normally loaded unless at least one extension is registered. Since no components are registered yet, we must explicitly load the framework.
110110

111-
* **debugManifestsFile:** specifies that we want to load SPFx components that are being locally served. Normally the loader only looks for components in the App Catalog (for your deployed solution) and the SharePoint manifest server (for the system libraries).
111+
* **debugManifestsFile:** specifies that we want to load SPFx components that are being locally served. Normally the loader only looks for components in the App Catalog (for your deployed solution) and the SharePoint manifest server (for the system libraries).
112112

113-
* **customActions:** this URL query parameter simulates a custom action. When we actually deploy and register this component in a site later in this lab, we’ll create this CustomAction object for real and describe all the different properties you can set on it.
113+
* **customActions:** this URL query parameter simulates a custom action. When we actually deploy and register this component in a site later in this lab, we’ll create this CustomAction object for real and describe all the different properties you can set on it.
114114
* **Key:** use the Guid of the extension as the key to associate with the custom action
115115
* **Location:** the type of custom action, use "ClientSideExtension.ApplicationCustomizer" for the Application Customizer extension
116116
* **Properties:** an optional JSON object containing properties that will be available via the this.properties member. In this HelloWorld example, it defined a ‘testMessage’ property.
117117

118118

119-
Navigate to a out of the box modern list in SharePoint Online. This can be a list or a library for the initial testing. Application customizers are also supported in modern pages and in Site Contents page.
119+
Navigate to a out of the box modern list in SharePoint Online. This can be a list or a library for the initial testing. Application customizers are also supported in modern pages and on the Site Contents page.
120120

121-
Extend the URL with the additional query parameters defined above. Notice that you'll need to update the GUID to match ID of your custom Application Customizer available from **HelloWorldApplicationCustomizer.manifest.json** at the src\extensions\helloWorld folder.
121+
Extend the URL with the additional query parameters defined above. Notice that you'll need to update the GUID to match the ID of your custom Application Customizer available from **HelloWorldApplicationCustomizer.manifest.json** at the src\extensions\helloWorld folder.
122122

123-
Full URL should be looking somewhat follows depending on your tenant URL.
123+
The full URL should look similar to the following depending on your tenant URL:
124124

125125
```
126126
contoso.sharepoint.com/Lists/Contoso/AllItems.aspx?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js&customActions={"5fc73e12-8085-4a4b-8743-f6d02ffe1240":{"___location":"ClientSideExtension.ApplicationCustomizer","properties":{"testMessage":"Hello as property!"}}}
127127
```
128128

129129
![Allow Debug Manifest question from the page](../../../../images/ext-app-debug-manifest-message.png)
130130

131-
Click "**Load debug scripts**" button to continue loading scripts from your local host.
131+
Click the "**Load debug scripts**" button to continue loading scripts from your local host.
132132

133-
You should now see the alert message in your page.
133+
You should now see the alert message on your page.
134134

135135
![Allow Debug Manifest question from the page](../../../../images/ext-app-alert-sp-page.png)
136136

137-
This alert is thrown by your SharePoint Framework Extension. Notice also that since we provided testMessage property as part of the debug query parameters, it's included in the alert message. You can configure your extension instances based on the client component properties, which are passed for the instance also in runtime mode.
137+
This alert is thrown by your SharePoint Framework Extension. Notice also that since we provided the testMessage property as part of the debug query parameters, it's included in the alert message. You can configure your extension instances based on the client component properties, which are passed for the instance also in runtime mode.
138138

139-
> If you are having challenges for making the debugging to work, double check the URL query parameters used for the query. Some browsers tend to encode the parameters in some scenarios, which will impact the behavior.
139+
> If you are having challenges in getting debugging to work, double check the URL query parameters used for the query. Some browsers tend to encode the parameters and in some scenarios this will impact the behavior.
140140
141141
## Next steps
142-
Congratulations on getting your first SharePoint Framework Extension running! Now that your extension is running, you can continue building out your extension in the next topic, [Using page placeholders from Application Customizer (Hello World part 2)](./using-page-placeholder-with-extensions.md). You will use the same project and take advantage of specific content place holders, for modifying the UI of SharePoint. Notice that the `gulp serve` command is still running in your console window (or in Visual Studio Code if you using the editor). You can continue to let it run while you go to the next article.
142+
Congratulations on getting your first SharePoint Framework Extension running! Now that your extension is running, you can continue building out your extension in the next topic, [Using page placeholders from Application Customizer (Hello World part 2)](./using-page-placeholder-with-extensions.md). You will use the same project and take advantage of specific content placeholders for modifying the UI of SharePoint. Notice that the ```gulp serve``` command is still running in your console window (or in Visual Studio Code if you are using the editor). You can continue to let it run while you go to the next article.

docs/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ Append the following query string parameters to the URL. Notice that you will ne
135135

136136
* **loadSPFX=true:** ensures that the SharePoint Framework is loaded on the page. For performance reasons, the framework normally is not loaded unless at least one extension is registered. Since no components are registered yet, we must explicitly load the framework.
137137
* **debugManifestsFile:** specifies that we want to load SPFx components that are being locally served. Normally the loader only looks for components in the App Catalog (for your deployed solution) and the SharePoint manifest server (for the system libraries).
138-
* **customActions:** this URL query parameter simulates a custom action. There are many properties you can set on this CustomAction object that affect the look, feel, and ___location of your button; we’ll cover them all later.
138+
* **customActions:** this URL query parameter simulates a custom action. There are many properties you can set on this *CustomAction* object that affect the look, feel, and ___location of your button; we’ll cover them all later.
139139
* **Key:** guid of the extension
140140
* **Location:** where the commands are displayed. The possible values are:
141141
* **ClientSideExtension.ListViewCommandSet.ContextMenu:** The context menu of the items
142142
* **ClientSideExtension.ListViewCommandSet.CommandBar:** The top command set menu in a list or library
143143
* **ClientSideExtension.ListViewCommandSet:** Both context menu and also command bar
144144
(Corresponds to SPUserCustomAction.Location="CommandUI.Ribbon")
145-
* **Properties:** an optional JSON object containing properties that will be available via the this.properties member. In this HelloWorld example, it defined a ‘testMessage’ property.
145+
* **Properties:** an optional JSON object containing properties that will be available via the `this.properties` member. In this HelloWorld example, it defined a *‘testMessage’* property.
146146

147147
Full URL should be something like following, depending on your tenant URL and the ___location of the newly created list.
148148

@@ -299,7 +299,7 @@ To ensure that our newly added **element.xml** file is taken into account while
299299

300300
## Deploy field to SharePoint Online and host JavaScript from local host
301301

302-
Now you are ready to deploy the solution to SharePoint site and to get the CustomAction automatically associated on the site level.
302+
Now you are ready to deploy the solution to SharePoint site and to get the *CustomAction* automatically associated on the site level.
303303

304304
In the console window, enter the following command to package your client-side solution that contains the extension, so that we get the basic structure ready for packaging:
305305

@@ -337,7 +337,7 @@ gulp serve --nobrowser
337337

338338
Go to the site where you want to test SharePoint asset provisioning. This could be any site collection in the tenant where you deployed this solution package.
339339

340-
Chose the gears icon on the top nav bar on the right and choose **Add an app** to go to your Apps page.
340+
Chose the gears icon on the top navigation bar on the right and choose **Add an app** to go to your Apps page.
341341

342342
In the **Search** box, enter '**command**' and choose *Enter* to filter your apps.
343343

0 commit comments

Comments
 (0)