Skip to content

Commit c42f8f7

Browse files
Merge pull request SharePoint#4806 from andrewconnell/prrollup-formatting
PR Rollup: fixing markdown formatting
2 parents 6fcc18b + 03be628 commit c42f8f7

9 files changed

+1156
-1247
lines changed
Binary file not shown.
-47.1 KB
Binary file not shown.

docs/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints.md

Lines changed: 83 additions & 119 deletions
Large diffs are not rendered by default.

docs/spfx/known-issues-and-common-questions.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
---
22
title: SharePoint Framework known issues and frequently asked questions
33
description: Find answers to issues and FAQ about the SharePoint Framework.
4-
ms.date: 01/12/2018
4+
ms.date: 10/22/2019
55
ms.prod: sharepoint
66
localization_priority: Priority
77
---
8-
9-
108
# SharePoint Framework known issues and frequently asked questions
119

12-
This page is for listing any known issues or to answer any frequently asked questions about SharePoint Framework.
10+
This page is for listing any known issues or to answer any frequently asked questions about SharePoint Framework.
1311

1412
## Known issues
1513

@@ -20,9 +18,9 @@ This page is for listing any known issues or to answer any frequently asked ques
2018

2119
If you are using Chrome as your development browser, you might have challenges with the developer certificate regardless of executing the `gulp trust-dev-cert` command. Chrome has changed its model for certificate validation starting from version 58, and you might see a "Your connection is not private" warning when you are accessing the local workbench.
2220

23-
You should update your Yeoman template packages. We have updated certification creation logic in the [*@microsoft/gulp-core-build-serve* package](https://www.npmjs.com/package/@microsoft/gulp-core-build-serve).
21+
You should update your Yeoman template packages. We have updated certification creation logic in the [*\@microsoft/gulp-core-build-serve* package](https://www.npmjs.com/package/@microsoft/gulp-core-build-serve).
2422

25-
In existing solutions, you can simply delete this folder and run `npm install` to get the updated package. You also need to execute `untrust-dev-cert` and `trust-dev-cert` commands on your machine to address the certification creation logic issue.
23+
In existing solutions, you can simply delete this folder and run `npm install` to get the updated package. You also need to execute `untrust-dev-cert` and `trust-dev-cert` commands on your machine to address the certification creation logic issue.
2624

2725
## Frequently asked questions
2826

@@ -43,8 +41,7 @@ SharePoint Framework client-side web parts on classic pages were released to Sha
4341

4442
## See also
4543

46-
Please use following resources to provide feedback, comments, and questions to SharePoint engineering.
44+
Please use following resources to provide feedback, comments, and questions to SharePoint engineering.
4745

4846
- [GitHub sp-dev-docs issues](https://github.com/SharePoint/sp-dev-docs/issues)
4947
- [SharePoint Developer Microsoft Tech Community space](https://aka.ms/sppnp-community)
50-

docs/spfx/use-theme-colors-in-your-customizations.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
---
22
title: Use theme colors in your SharePoint Framework customizations
33
description: Use theme colors so that your customizations look like a part of the site by referring to the theme colors of the context site in your SharePoint Framework solution.
4-
ms.date: 01/24/2018
4+
ms.date: 10/22/2019
55
ms.prod: sharepoint
66
localization_priority: Priority
77
---
8-
9-
108
# Use theme colors in your SharePoint Framework customizations
119

1210
When building SharePoint Framework customizations, you should use theme colors so that your customizations look like a part of the site. This article explains how can you refer to the theme colors of the context site in your SharePoint Framework solution.
1311

14-
> [!NOTE]
12+
> [!NOTE]
1513
> Although this article uses a SharePoint Framework client-side web part as an example, the described techniques apply to all types of SharePoint Framework customizations.
1614
1715
## Fixed colors vs. theme colors
@@ -30,49 +28,45 @@ When working with fixed colors, you specify them in CSS properties, for example:
3028

3129
```css
3230
.button {
33-
background-color: #0078d7;
31+
background-color: #0078d7;
3432
}
3533
```
3634

37-
<br/>
38-
3935
To use a theme color instead, replace the fixed color with a theme token:
4036

4137
```css
4238
.button {
43-
background-color: "[theme: themePrimary, default: #0078d7]";
39+
background-color: "[theme: themePrimary, default: #0078d7]";
4440
}
4541
```
4642

47-
<br/>
48-
49-
When your SharePoint Framework customization is loading on the page, the **@microsoft/load-themed-styles** package, which is a part of the SharePoint Framework, looks for theme tokens in CSS files and tries to replace them with the corresponding color from the current theme. If the value for the specified token is not available, SharePoint Framework uses the value specified by using the **default** parameter instead, which is why it's important that you always include it.
43+
When your SharePoint Framework customization is loading on the page, the **\@microsoft/load-themed-styles** package, which is a part of the SharePoint Framework, looks for theme tokens in CSS files and tries to replace them with the corresponding color from the current theme. If the value for the specified token is not available, SharePoint Framework uses the value specified by using the **default** parameter instead, which is why it's important that you always include it.
5044

5145
The following theme tokens are available for you to use:
5246

53-
Token|Default value on a modern team site using the red palette|Remarks
54-
-----|--------------------------------|-----------
55-
`backgroundImageUri`|`none`|
56-
`accent`|`#ee0410`|
57-
`themeDark`|`#b3030c`|Used for action icons in the command bar and as a hover color.
58-
`themeDarkAlt`|`#b3030c`|
59-
`themeDarker`|`#770208`|
60-
`themeLight`|`#fd969b`|
61-
`themeLightAlt`|`#fd969b`|
62-
`themeLighter`|`#fecacd`|
63-
`themeLighterAlt`|`#fecacd`|
64-
`themePrimary`|`#ee0410`|Primary theme color. Used for icons and default buttons.
65-
`themeSecondary`|`#fc6169`|
66-
`themeTertiary`|`#fd969b`|
67-
68-
> [!NOTE]
47+
| Token | Default value on a modern team site using the red palette | Remarks |
48+
| -------------------- | --------------------------------------------------------- | -------------------------------------------------------------- |
49+
| `backgroundImageUri` | `none` | |
50+
| `accent` | `#ee0410` | |
51+
| `themeDark` | `#b3030c` | Used for action icons in the command bar and as a hover color. |
52+
| `themeDarkAlt` | `#b3030c` | |
53+
| `themeDarker` | `#770208` | |
54+
| `themeLight` | `#fd969b` | |
55+
| `themeLightAlt` | `#fd969b` | |
56+
| `themeLighter` | `#fecacd` | |
57+
| `themeLighterAlt` | `#fecacd` | |
58+
| `themePrimary` | `#ee0410` | Primary theme color. Used for icons and default buttons. |
59+
| `themeSecondary` | `#fc6169` | |
60+
| `themeTertiary` | `#fd969b` | |
61+
62+
> [!NOTE]
6963
> There are more tokens registered with the SharePoint Framework. While all of them have values specified on classic sites, only the subset mentioned earlier has values on modern SharePoint sites. For the complete list of available tokens, see the value of the `window.__themeState__.theme` property by using the console in your web browser's developer tools.
7064
7165
## Use theme colors in your customizations
7266

7367
When you scaffold a new SharePoint Framework client-side web part, by default, it uses the fixed blue palette. The following steps describe the necessary adjustments to have the web part use theme colors instead.
7468

75-
> [!NOTE]
69+
> [!NOTE]
7670
> The following steps apply to a SharePoint Framework client-side web part named _HelloWorld_ built by using React. For web parts built using different libraries and other types of customizations, you might need to adjust the modifications accordingly.
7771
7872
### To use theme colors
@@ -81,35 +75,31 @@ When you scaffold a new SharePoint Framework client-side web part, by default, i
8175

8276
![The 'ms-bgColor-themeDark' class selected in Visual Studio Code editor](../images/themed-styles-ms-bgcolor-themedark-class.png)
8377

84-
2. In the same folder, open the **HelloWorld.module.scss** file. Change the `.row` selector to:
78+
1. In the same folder, open the **HelloWorld.module.scss** file. Change the `.row` selector to:
8579

8680
```css
8781
.row {
88-
padding: 20px;
89-
background-color: "[theme: themeDark, default: #005a9e]";
82+
padding: 20px;
83+
background-color: "[theme: themeDark, default: #005a9e]";
9084
}
9185
```
9286

93-
<br/>
94-
9587
![The .row selector extended with background color](../images/themed-styles-row-class.png)
9688

97-
3. In the `.button` selector, change the `background-color` and `border-color` properties to:
89+
1. In the `.button` selector, change the `background-color` and `border-color` properties to:
9890

9991
```css
10092
.button {
101-
/* ... */
102-
background-color: "[theme: themePrimary, default: #0078d7]";
103-
border-color: "[theme: themePrimary, default: #0078d7]";
104-
/* ... */
93+
/* ... */
94+
background-color: "[theme: themePrimary, default: #0078d7]";
95+
border-color: "[theme: themePrimary, default: #0078d7]";
96+
/* ... */
10597
}
10698
```
10799

108-
<br/>
109-
110100
![The .button selector updated with references to theme colors](../images/themed-styles-button-class.png)
111101

112-
4. When you add the web part to a site, the colors used by the web part automatically adapt to the theme colors used by the current site.
102+
1. When you add the web part to a site, the colors used by the web part automatically adapt to the theme colors used by the current site.
113103

114104
![Side-by-side view of the same web part displayed in two sites using different colors. The web part follows the color scheme of each website](../images/themed-styles-side-by-side.png)
115105

docs/spfx/web-parts/basics/working-with-requestdigest.md

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
---
22
title: Work with __REQUESTDIGEST
3-
description: Add a valid request digest to your request when executing non-GET REST requests to the SharePoint API.
4-
ms.date: 01/09/2018
3+
description: Add a valid request digest to your request when executing non-GET REST requests to the SharePoint API.
4+
ms.date: 10/22/2019
55
ms.prod: sharepoint
66
localization_priority: Priority
77
---
8-
9-
108
# Work with __REQUESTDIGEST
119

12-
When executing non-GET REST requests to the SharePoint API, you must add a valid request digest to your request. This digest proves validity of your request to SharePoint. Because this token is valid only for a limited period of time, you have to ensure that the token you have is valid before adding it to your request or the request fails.
10+
When executing non-GET REST requests to the SharePoint API, you must add a valid request digest to your request. This digest proves validity of your request to SharePoint. Because this token is valid only for a limited period of time, you have to ensure that the token you have is valid before adding it to your request or the request fails.
1311

1412
In classic pages, SharePoint includes a request digest token on the page in a hidden field named **__REQUESTDIGEST**. One of the most common approaches to work with the request digest is to obtain it from that field and add it to the request, for example:
1513

@@ -31,59 +29,59 @@ $.ajax({
3129
});
3230
```
3331

34-
Such a request would work initially, but if the user has the page open for a longer period of time, the request digest on the page expires and the request fails with a **403 FORBIDDEN** result. By default, a request digest token is valid for 30 minutes, so before using it, you have to ensure that it's still valid. In the past you had to do this manually, by comparing the timestamp from the request digest with the current time.
32+
Such a request would work initially, but if the user has the page open for a longer period of time, the request digest on the page expires and the request fails with a **403 FORBIDDEN** result. By default, a request digest token is valid for 30 minutes, so before using it, you have to ensure that it's still valid. In the past you had to do this manually, by comparing the timestamp from the request digest with the current time.
3533

3634
SharePoint Framework simplifies this process by offering you two ways of ensuring that your request has a valid request digest token.
3735

3836
## Use the SPHttpClient to communicate with the SharePoint REST API
3937

40-
The recommended way to communicate with the SharePoint REST API is to use the SPHttpClient provided with the SharePoint Framework. This class wraps issuing REST requests to the SharePoint REST API with convenient logic that simplifies your code.
38+
The recommended way to communicate with the SharePoint REST API is to use the SPHttpClient provided with the SharePoint Framework. This class wraps issuing REST requests to the SharePoint REST API with convenient logic that simplifies your code.
4139

4240
For example, whenever you issue a non-GET request using the SPHttpClient, it automatically obtains a valid request digest and adds it to the request. This significantly simplifies your solution because you don't need to build code to manage request digest tokens and ensure their validity.
4341

44-
If you're building new customizations on the SharePoint Framework, you should always use the SPHttpClient to communicate with the SharePoint REST API.
42+
If you're building new customizations on the SharePoint Framework, you should always use the SPHttpClient to communicate with the SharePoint REST API.
4543

4644
Sometimes, however, you might not be able to use the SPHttpClient. This can be the case, for example, when you're migrating an existing customization to the SharePoint Framework and want to keep as much of the original code as possible, or you're building a customization by using a library such as Angular(JS) that has its own services for issuing web requests. In such cases you can obtain a valid request digest token from the **DigestCache**.
4745

4846
## Retrieve a valid request digest by using the DigestCache service
4947

50-
If you can't use the SPHttpClient for communicating with the SharePoint REST API, you can obtain a valid request digest token by using the **DigestCache** service provided with the SharePoint Framework.
48+
If you can't use the SPHttpClient for communicating with the SharePoint REST API, you can obtain a valid request digest token by using the **DigestCache** service provided with the SharePoint Framework.
5149

5250
The benefit of using the DigestCache service over manually obtaining a valid request digest token is that the DigestCache automatically checks if the previously retrieved request digest is still valid. If it's expired, the DigestCache service automatically requests a new request digest token from SharePoint and stores it from subsequent requests. Using the DigestCache simplifies your code and makes your solution more robust.
5351

5452
### To use the DigestCache service in your code
5553

56-
1. Import the **DigestCache** and **IDigestCache** types from the **@microsoft/sp-http** package:
57-
58-
```typescript
59-
// ...
60-
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
54+
1. Import the **DigestCache** and **IDigestCache** types from the **\@microsoft/sp-http** package:
6155

62-
export default class HelloWorldWebPart extends BaseClientSideWebPart<IHelloWorldWebPartProps> {
56+
```ts
6357
// ...
64-
}
65-
```
66-
67-
2. Whenever you need a valid request digest token, retrieve a reference to the DigestCache service, and call its **fetchDigest** method:
68-
69-
```typescript
70-
// ...
71-
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
72-
73-
export default class HelloWorldWebPart extends BaseClientSideWebPart<IHelloWorldWebPartProps> {
74-
protected onInit(): Promise<void> {
75-
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
76-
const digestCache: IDigestCache = this.context.serviceScope.consume(DigestCache.serviceKey);
77-
digestCache.fetchDigest(this.context.pageContext.web.serverRelativeUrl).then((digest: string): void => {
78-
// use the digest here
79-
resolve();
80-
});
81-
});
58+
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
59+
60+
export default class HelloWorldWebPart extends BaseClientSideWebPart<IHelloWorldWebPartProps> {
61+
// ...
8262
}
63+
```
8364

65+
1. Whenever you need a valid request digest token, retrieve a reference to the DigestCache service, and call its **fetchDigest** method:
66+
67+
```ts
8468
// ...
85-
}
86-
```
69+
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
70+
71+
export default class HelloWorldWebPart extends BaseClientSideWebPart<IHelloWorldWebPartProps> {
72+
protected onInit(): Promise<void> {
73+
return new Promise<void>((resolve: () => void, reject: (error: any) => void): void => {
74+
const digestCache: IDigestCache = this.context.serviceScope.consume(DigestCache.serviceKey);
75+
digestCache.fetchDigest(this.context.pageContext.web.serverRelativeUrl).then((digest: string): void => {
76+
// use the digest here
77+
resolve();
78+
});
79+
});
80+
}
81+
82+
// ...
83+
}
84+
```
8785

8886
## See also
8987

0 commit comments

Comments
 (0)