Hemant's Blogs

Monday, April 8, 2019

Line 13: example, how to connect using SharePointPnP.PowerShell with SharePoint Online
Line19: Example how to create site collection level Term Group.
Line 23: A possible alternative to "Import-PnPTermSet" using "Import-Csv", "Export-Csv" and "New-PnPTermSet"

Friday, April 5, 2019

Introduction

This collection of API's can be used to communicate with SharePoint 2016 (on-premise ) via REST API's with form digest or using Bearer Token with SharePoint Online. This collection is tried on Document Library with Major version available(only). Calling party is assumed to have GUIDs of the taxonomies.One more important thing to highlight, under "Send Metada data without version update 1st time after upload" and "Send modifier without version update", I have used adusername [without even domain name] to refer to SharePoint user. You may also leverage email address. But in any case, this user must be validated for presence by "Ensureuser" REST call before consuming in any of the dependent API’s.

Authentication

In case of onperim we are using Formdigest for authentication. with SharePoint Online, you may create a SharePoint addin app and authrize with bearer token.

POST 01.01 GetFormDigest

https://servernamehidden:3434/sites/hkDev/_api/contextinfo

Extract FormDigest token
from SharePoint 2016 with username and password. Authorization:NTLM (along with username and password). use
FormDigestValue from the response as a header (X-RequestDigest) for future
calls, when expires, get a new value from here.

Headers

accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Refreshes FormDigest with previous FormDigest as an input in the header.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Extracts a SPGroup from a site identified by Title or LoginName.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Checks whether the specified login name belongs to a valid user in the site. If the user doesn't exist, adds the user to the site. pass json body like { "logonName": "i:0#.w|domain\aduserloginname" }

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Extract a user’s properties from the site identified by
loginName. Say, loginName property for user is
"i:0#.w|domainnamehidden\\loginadidhidden".

I could user filter which says give me the users which contain
a string value "domainnamehidden\loginadidhidden"

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Remove a user identified by @usrid from an SP Group
identified by @grpid.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

send file in single call. Won't work well with large files. Pass binary in the body.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

while chunk upload, if there is no previous version at this path, create a dummy file

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Checkout an existing file OR the dummy one just created. You may want to check out a file to make sure that no one changes it before you update it. After your update, you should check the file back in so that others can work with it.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

send forth chunk step 4, and so on till last chunk. pass binary in the body.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

send atleast mandatory fields please, step 6. body contains JSON of formValues and bNewDocumentUpdate. bNewDocumentUpdate needs to be true to avoid ++version. checkincomments can also be passed in body if file was checkedout.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

if the file was checked out, this is needed - to fix
Editor ( we want to store actual editor, since we are using service account).
Reason being checkout was done by Service account, not the actual user. And
hence modifier is changed to service user
after sending metadata in the last call.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

get metadata for the file.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

get specific metadata for
the file.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.

Headers

Accept

application/json;odata=verbose

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Verbose JSON is not the default OData format. To receive responses in Verbose JSON, the client MUST explicitly ask for them.