This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function() { | |
function getFailedResponseData(response) { | |
return new Promise( async (resolve) => { | |
const ct = response.headers.get("Content-Type") || ""; | |
let data = {}; | |
if (ct.match("application/json")) { | |
data = await response.json(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST https://platinumdogsconsulting.sharepoint.com/sites/hubsitetest/_api/site/GetCopyJobProgress | |
HEADERS | |
{ | |
Accept: application/json;odata=verbose | |
Content-Type: application/json;odata=verbose | |
X-RequestDigest: <<site form digest>> | |
} | |
BODY | |
{ | |
"copyJobInfo": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function() { | |
function getAccessToken(resource) { | |
return new Promise( async (resolve, reject) => { | |
var body = { | |
"resource": resource || "https://graph.microsoft.com" | |
}; | |
const url = `${_spPageContextInfo.webAbsoluteUrl}/_api/SP.OAuth.Token/Acquire`; | |
const response = await fetch(url, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$tenantId, | |
[string]$userName, | |
[string]$userPassword, | |
[string]$subscriptionId, | |
[switch]$production, | |
[switch]$quiet | |
) | |
## Connecting to site | |
Clear-Host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /{tenant id}/oauth2/token HTTP/1.1 | |
Host: login.microsoftonline.com | |
Content-Type: application/x-www-form-urlencoded | |
cache-control: no-cache | |
client_id:{client id} | |
client_secret:{client secret} | |
grant_type:urn:ietf:params:oauth:grant-type:jwt-bearer | |
assertion:{access_token_value} | |
resource:https://graph.microsoft.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /{tenant id}/oauth2/token HTTP/1.1 | |
Host: login.microsoftonline.com | |
Content-Type: application/x-www-form-urlencoded | |
cache-control: no-cache | |
client_id:{client id} | |
client_secret:{client secret} | |
grant_type:refresh_token | |
refresh_token:{refresh_token_value} | |
resource:https://graph.microsoft.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /{tenant id}/oauth2/token HTTP/1.1 | |
Host: login.microsoftonline.com | |
Content-Type: application/x-www-form-urlencoded | |
cache-control: no-cache | |
client_id:{client id} | |
client_secret:{client secret} | |
grant_type:password | |
resource:https://graph.microsoft.com/ | |
username:{user upn} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /tenant id/oauth2/token HTTP/1.1 | |
Host: login.microsoftonline.com | |
Content-Type: application/x-www-form-urlencoded | |
cache-control: no-cache | |
client_id:the client id | |
client_secret:the client secret | |
grant_type:client_credentials | |
resource:https://graph.microsoft.com/ |