Skip to content

Commit a0ceb63

Browse files
committed
update doc accuracy & readability
- removes redundant code - fixes multiple readability issues to improve acrolynx score - closes SharePoint#6404
1 parent 58e8cd5 commit a0ceb63

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

docs/sp-add-ins/using-csom-for-dotnet-standard.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Using CSOM for .Net Standard instead of CSOM for .Net Framework
3-
description: Explains the differences between using CSOM for .Net Standard versus CSOM for .Net Framework
4-
ms.date: 6/29/2020
2+
title: Using CSOM for .NET Standard instead of CSOM for .NET Framework
3+
description: Explains the differences between using CSOM for .NET Standard versus CSOM for .NET Framework
4+
ms.date: 10/26/2020
55
ms.prod: sharepoint
66
localization_priority: Priority
77
---
@@ -15,7 +15,7 @@ You can use the SharePoint client object model (CSOM) to retrieve, update, and m
1515
- JavaScript library (JSOM)
1616
- REST/OData endpoints
1717

18-
In this article we'll focus on explaining what the differences are between the .NET Framework version and the .NET Standard version redistributable. In many ways both versions are identical and if you've been writing code using the .NET Framework version then that code and everything you've learned will for the most part still be relevant when working with the .NET Standard version.
18+
In this article, we'll focus on explaining what the differences are between the .NET Framework version and the .NET Standard version redistributable. In many ways both versions are identical and if you've been writing code using the .NET Framework version then that code and everything you've learned is, for the most part, still relevant when working with the .NET Standard version.
1919

2020
## Key differences between the .NET Framework version and the .NET Standard version
2121

@@ -24,46 +24,40 @@ Below table outlines the differences between both versions and provides guidelin
2424
CSOM feature | .NET Framework version | .NET Standard version | Guidelines
2525
-------------|------------------------|-----------------------|------------
2626
.NET supportability | .NET Framework 4.5+ | .NET Framework 4.6.1+, .NET Core 2.0+, Mono 5.4+ ([.NET docs](https://docs.microsoft.com/dotnet/standard/net-standard)) | It's recommended to use the CSOM for .NET Standard version for all your SharePoint Online CSOM developments
27-
Cross platform | No | Yes (can be used on any platform that support .NET Standard) | For cross platform you have to use CSOM for .NET Standard
27+
Cross platform | No | Yes (can be used on any platform that support .NET Standard) | For cross platform, you have to use CSOM for .NET Standard
2828
On-Premises SharePoint support | Yes | No | The CSOM .NET Framework versions are still fully supported and being updated, so use those for on-premises SharePoint development
2929
Support for legacy authentication flows (so called cookie based auth using the `SharePointOnlineCredentials` class) | Yes | No | See the **Using modern authentication with CSOM for .NET Standard** chapter. Using Azure AD applications to configure authentication for SharePoint Online is the recommended approach
30-
`SaveBinaryDirect` / `OpenBinaryDirect` API's (webdav based) | Yes | No | Use the regular file API's in CSOM as it's not recommended to use the BinaryDirect API's, even not when using the .NET Framework version
30+
`SaveBinaryDirect` / `OpenBinaryDirect` APIs (webdav based) | Yes | No | Use the regular file APIs in CSOM as it's not recommended to use the BinaryDirect APIs, even not when using the .NET Framework version
3131
`Microsoft.SharePoint.Client.Utilities.HttpUtility` class | Yes | No | Switch to similar classes in .NET such as `System.Web.HttpUtility`
3232
`Microsoft.SharePoint.Client.EventReceivers` namespace | Yes | No | Switch to modern eventing concepts such as [Web Hooks](../apis/webhooks/get-started-webhooks.md).
3333

3434
## Using modern authentication with CSOM for .NET Standard
3535

36-
Using user/password based authentication, implemented via the `SharePointOnlineCredentials` class, is a common approach for developers using CSOM for .NET Framework. In CSOM for .NET Standard this is not possible anymore, it's up to the developer using CSOM for .NET Standard to obtain an OAuth access token and use that when making calls to SharePoint Online. The recommended approach for getting access tokens for SharePoint Online is by setting up an Azure AD application. For CSOM for .NET Standard the only thing that matters is that you obtain a valid access token, this can be using resource owner password credential flow, using device login, using certificate based auth,...
36+
Using user/password based authentication, implemented via the `SharePointOnlineCredentials` class, is a common approach for developers using CSOM for .NET Framework. In CSOM for .NET Standard this isn't possible anymore, it's up to the developer using CSOM for .NET Standard to obtain an OAuth access token and use that when making calls to SharePoint Online. The recommended approach for getting access tokens for SharePoint Online is by setting up an Azure AD application. For CSOM for .NET Standard the only thing that matters are that you obtain a valid access token, this can be using resource owner password credential flow, using device login, using certificate based auth,...
3737

38-
In this chapter we'll use an OAuth resource owner password credential flow resulting in an OAuth access token that then is used by CSOM for authenticating requests against SharePoint Online as that mimics the behavior of the `SharePointOnlineCredentials` class.
38+
In this chapter, we'll use an OAuth resource owner password credential flow resulting in an OAuth access token that then is used by CSOM for authenticating requests against SharePoint Online as that mimics the behavior of the `SharePointOnlineCredentials` class.
3939

4040
### Configuring an application in Azure AD
4141

4242
Below steps will help you create and configure an application in Azure Active Directory:
4343

4444
- Go to Azure AD Portal via https://aad.portal.azure.com
45-
- Click on **Azure Active Directory** and on **App registrations** in the left navigation
46-
- Click on **New registration**
47-
- Enter a name for your application and click on **Register**
48-
- Go to **API permissions** to grant permissions to your application, click on **Add a permission**, choose **SharePoint**, **Delegated permissions** and select for example **AllSites.Manage**
49-
- Click on **Grant admin consent** to consent the application's requested permissions
50-
- Click on **Authentication** in the left navigation
45+
- Select **Azure Active Directory** and on **App registrations** in the left navigation
46+
- Select **New registration**
47+
- Enter a name for your application and select **Register**
48+
- Go to **API permissions** to grant permissions to your application, select **Add a permission**, choose **SharePoint**, **Delegated permissions** and select for example **AllSites.Manage**
49+
- Select **Grant admin consent** to consent the application's requested permissions
50+
- Select **Authentication** in the left navigation
5151
- Change **Default client type - Treat application as public client** from No to **Yes**
52-
- Click on **Overview** and copy the application id to the clipboard (you'll need it later on)
52+
- Select **Overview** and copy the application ID to the clipboard (you'll need it later on)
5353

54-
### Getting an access token from Azure AD and using that in your CSOM for .NET Standard based application
54+
### Getting an access token from Azure AD and using that in your CSOM for .NET Standard-based application
5555

56-
When using CSOM for .NET Standard it's the responsibility of the developer to obtain an access token for SharePoint Online and ensure it's inserted into each call made to SharePoint Online. A common code pattern to realize this is shown below:
56+
When using CSOM for .NET Standard it's the responsibility of the developer to obtain an access token for SharePoint Online and ensure, it's inserted into each call made to SharePoint Online. A common code pattern to realize this is shown below:
5757

5858
```csharp
5959
public ClientContext GetContext(Uri web, string userPrincipalName, SecureString userPassword)
6060
{
61-
var context = new ClientContext(web)
62-
{
63-
// Important to turn off FormDigestHandling when using access tokens
64-
FormDigestHandlingEnabled = false
65-
};
66-
6761
context.ExecutingWebRequest += (sender, e) =>
6862
{
6963
// Get an access token using your preferred approach

0 commit comments

Comments
 (0)