Introduction
⚡️ SharePoint SDK for Go (Golang)
Main features
Unattended authentication using different strategies.
Fluent API syntax for SharePoint object model.
Simplified API consumption (REST, CSOM, SOAP, etc.).
SharePoint-aware embedded features (retries, header presets, error handling).
Supported SharePoint versions
SharePoint Online (SPO).
On-Premises (2019/2016/2013).
Supported auth strategies
SharePoint Online:
SAML based with user credentials
Add-In only permissions
ADFS user credentials (automatically detects in SAML strategy)
SharePoint On-Premises 2019/2016/2013:
User credentials (NTLM)
ADFS user credentials (ADFS, WAP -> Basic/NTLM, WAP -> ADFS)
Behind a reverse proxy (Forefront TMG, WAP -> Basic/NTLM, WAP -> ADFS)
Installation
Usage insights
Understand SharePoint environment type and authentication strategy
Let's assume it's SharePoint Online and Add-In Only permissions. Then strategy "github.com/koltyakov/gosip/auth/addin"
sub package should be used.
Initiate authentication object
AuthCnfg's from different strategies contains different options relevant for a specified auth type.
The authentication options can be provided explicitly or can be read from a configuration file (see more).
Bind auth client with Fluent API
Usage samples
Fluent API client
Provides a simple way of constructing API endpoint calls with IntelliSense and chainable syntax.
Generic HTTP-client helper
Provides generic GET/POST helpers for REST operations, reducing amount of http.NewRequest
scaffolded code, can be used for custom or not covered with a Fluent API endpoints.
Low-level HTTP-client usage
Low-lever SharePoint-aware HTTP client from github.com/koltyakov/gosip
package for custom or not covered with a Fluent API client endpoints with granular control for HTTP request, response, and http.Client
parameters. Used internally but almost never required in a consumer code.
SPClient has Execute
method which is a wrapper function injecting SharePoint authentication and ending up calling http.Client
's Do
method.
Reference
Many auth flows have been "copied" from node-sp-auth library (used as a blueprint), which we intensively use in Node.js ecosystem for years.
Fluent API and wrapper syntax are inspired by PnPjs which is also the first-class citizen on almost all our Node.js and front-end projects with SharePoint involved.
License
Last updated