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/overview-graphhttpclient.md
+11-10Lines changed: 11 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Overview of the GraphHttpClient class (preview)
2
2
3
3
> [!IMPORTANT]
4
-
>The **GraphHttpClient** is currently in preview and is subject to change. It is not currently supported for use in production environments.
4
+
>The **GraphHttpClient** is currently in preview and is subject to change. It is not currently supported for use in production environments.
5
5
6
6
You can use Microsoft Graph to build powerful solutions that access data from Office 365 and other Microsoft services. To connect SharePoint Framework (SPFx) solutions to Microsoft Graph, you have to register an Azure Active Directory (Azure AD) application and complete the authorization flow. To make this easier, you can use the SPFx **GraphHttpClient** class to call Microsoft Graph directly, without any additional setup.
7
7
@@ -13,7 +13,7 @@ The following example shows a request to Microsoft Graph that uses the **GraphHt
@@ -32,27 +32,28 @@ export default class MyApplicationCustomizer
32
32
}
33
33
}
34
34
```
35
+
35
36
To make a request to Microsoft Graph:
36
37
37
-
- Import the **GraphHttpClient** and **GraphClientResponse** modules from the **@microsoft/sp-http** package.
38
-
- Use the instance of **GraphHttpClient** that's available on the `this.context.graphHttpClient` property to issue a GET or POST request to Microsoft Graph.
39
-
- As parameters, specify the Microsoft Graph API that you want to call (start with the API version without a leading `/` - slash), followed by the **GraphHttpClient** configuration.
38
+
- Import the **GraphHttpClient** and **GraphHttpClientResponse** modules from the **@microsoft/sp-http** package.
39
+
- Use the instance of **GraphHttpClient** that's available on the `this.context.graphHttpClient` property to issue a GET or POST request to Microsoft Graph.
40
+
- As parameters, specify the Microsoft Graph API that you want to call (start with the API version without a leading `/` - slash), followed by the **GraphHttpClient** configuration.
40
41
- Optionally, you can specify additional request headers that will be merged with the default headers set by **GraphHttpClient** (`'Accept': 'application/json'`, `'Authorization': 'Bearer [token]'` and `'Content-Type': 'application/json; charset=utf-8'`).
41
42
42
43
## Considerations for using the **GraphHttpClient** class
43
44
44
-
The **GraphHttpClient** class provides a convenient way to communicate with Microsoft Graph because it abstracts the authorization flow and management of access tokens. Because **GraphHttpClient** is currently in developer preview, there are some considerations that you should take into account before using it.
45
+
The **GraphHttpClient** class provides a convenient way to communicate with Microsoft Graph because it abstracts the authorization flow and management of access tokens. Because **GraphHttpClient** is currently in developer preview, there are some considerations that you should take into account before using it.
45
46
46
47
### Use for Microsoft Graph access only
47
48
48
49
Use the **GraphHttpClient** class only to access Microsoft Graph. The URL specified in the request must begin with the version of the Microsoft Graph API (either **v1.0** or **beta**), followed by the API operation. Any other URL will return an error.
49
50
50
51
### Permissions
51
52
52
-
The GraphHttpClient uses the Office 365 SharePoint Online Azure AD application to retrieve a valid access token to Microsoft Graph on behalf of the current user. The retrieved access token contains two permissions:
53
+
The GraphHttpClient uses the Office 365 SharePoint Online Azure AD application to retrieve a valid access token to Microsoft Graph on behalf of the current user. The retrieved access token contains two permissions:
53
54
54
-
* Read and write all groups (preview) (`Group.ReadWrite.All`)
55
-
* Read all usage reports (`Reports.Read.All`)
55
+
- Read and write all groups (preview) (`Group.ReadWrite.All`)
56
+
- Read all usage reports (`Reports.Read.All`)
56
57
57
58
These are the only permissions that are available when you use **GraphHttpClient**. If you need other permissions for your solution, you can use [ADAL JS with implicit OAuth flow](web-parts/guidance/call-microsoft-graph-from-your-web-part.md) instead.
0 commit comments