Graph.Community.SPClient 5.7.0

dotnet add package Graph.Community.SPClient --version 5.7.0                
NuGet\Install-Package Graph.Community.SPClient -Version 5.7.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Graph.Community.SPClient" Version="5.7.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Graph.Community.SPClient --version 5.7.0                
#r "nuget: Graph.Community.SPClient, 5.7.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Graph.Community.SPClient as a Cake Addin
#addin nuget:?package=Graph.Community.SPClient&version=5.7.0

// Install Graph.Community.SPClient as a Cake Tool
#tool nuget:?package=Graph.Community.SPClient&version=5.7.0                

Graph Community SharePoint Client

The Graph.Community.SPClient library is a community effort to unblock developers building on .Net Standard who need to call endpoints that are not part of the Microsoft Graph.

Build NuGet package

Highlights

This community library is a Kiota-generate client for a subset of the SharePoint REST API (_api).

The client library allows for using the same coding practices and capabilities of the Microsoft Graph SDK. Key benefits of that library:

  • Leverage SDK-provided functionality such as authorization, compression and retries.
  • Provide a consistent coding style to the Microsoft cloud, regardless of the endpoint (Graph, SharePoint REST, etc.)

SharePoint REST API context

The SharePoint REST API must be called in the context of a site. As noted in the official documentation, The main entry points for the REST service represent the site collection and site of the specified context.:

  • https://{site_url}/_api/site
  • https://{site_url}/_api/web

The {site_url} in this context contains the tenant hostname (https://{tenant}.sharepoint.com) and the site path (/sites/{site_name}). When using the Graph.Community.SPClient:

  • The hostname must be provided to the factory method. (This sets the base url for all requests invoked via the client.)
  • The site path must be specified when building the request. The site path is an "indexer" into the sites collection. (While this is not technically correct, it matches the style of collections throughout Kiota-generated clients.)

Putting this together, a typical request to the SharePoint REST API looks like this:

var client = SPClientFactory.CreateClient("https://contoso.sharepoint.com", new TokenCredential(token));
var web = await spClient["/sites/somesite"]._api.Web.GetAsync();

SharePoint REST endpoints

View the Graph.Community OpenAPI description to see the specific endpoints included.

Some of the endpoints are adjusted to make them similar to typical REST (or Graph) style. Specific updates:

Endpoint Description
Site Designs/Site Scripts The namespace in this library is shorted to simply 'SiteScriptUtility'. Refer to the SiteDesign.cs file in the sample project.
Lists The SharePoint REST API uses a method syntax for Lists (e.g. _api/web/lists/getById or _api/web/lists/guid('{list_guid'})). In the SPClient, the list_guid is an indexer into the lists collection (e.g. `_api.Web.Lists[{list_guid}}]``)
SitePages The namespace in this library is shorted to simply 'SitePage'. Refer to the SitePage.cs file in the sample project.

If there is an endpoint node for which you would like a request, please submit an issue to initiate a conversation. This will help reduce wasted effort.

SharePoint models/objects

The top-level classes that are generated use the name assigned by the API metadata. This means the Graph.Community namespace contains classes named SPWeb, SPList, etc. These are not identical the classes found in the offical SharePoint CSOM SDK. This is intentional.

The Graph.Community.SPClient library is not intended to replace the CSOM libraries, nor the Graph SDK. The class contain only the properties that are not available thru Microsoft Graph. (But, all of the Kiota-generated classes contain a dictionary named AdditionalProperties. So what you are looking for may be in there. 😉 )

SharePoint service handler

The SharePoint REST endpoint requires a specific request header, and the error messages follow a proprietary format. The SPClient includes a delegating handler that inserts the header, and reformats service exceptions to an in stance of the ODataError class. This handler is automatically added to the Http pipeline when using the client factory class.

Getting Started

The samples folder includes a console application that demonstrates most of the client capabilities. The sample calls follow a standard pattern:

  • Create a TokenCredential for authenticating to SharePoint
  • Configure the client to log the request/response information (helpful for troubleshooting)
  • Invoke the endpoint

Configuring the client via the SPClientOptions class

The SPClientOptions class provides for setting the UserAgent string as required for SharePoint.

Using the client factory

The client factory requires the SharePoint hostname of the tenant. (This differs from Microsoft Graph, which uses a single hostname for all tenants.)

The factory also requires a TokenCredential instance or custom Authentication provider. SharePoint Online will accept a token from Entra Id if the scopes include the SharePoint tenant (https://[tenant].sharepoint.com/[scope]).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.7.0 65 2/13/2025
5.6.0 95 2/7/2025
5.5.2 65 2/5/2025
5.5.0 74 1/30/2025
5.4.0 40 1/29/2025
5.3.0 76 1/23/2025
5.2.1 63 1/13/2025
5.2.0 37 1/13/2025
5.1.0 445 6/7/2024
5.0.1 205 4/24/2024
5.0.0 131 4/24/2024
5.0.0-beta4 116 4/24/2024
5.0.0-beta 112 4/23/2024