Skip to content

Instantly share code, notes, and snippets.

Phil Harding phillipharding

Block or report user

Report or block phillipharding

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
phillipharding / Get O365 Groups using AdalJS and Graph on Classic SP Page.js
Last active Oct 10, 2019
Get Office 365 Groups and Current User Profile using the Graph API and AdalJS to acquire access tokens
View Get O365 Groups using AdalJS and Graph on Classic SP Page.js
/* Logging levels
0: Error
1: Warning
2: Info
3: Verbose
(function() {
/* LOAD ADAL.JS onto the page
phillipharding / Get Compliance Tags Available for a Site Collection
Created Jul 17, 2019
Returns the Office 365 Compliance Tags which have been published to a site collection
View Get Compliance Tags Available for a Site Collection
X-RequestDigest: {digest}
Content-Type: text/xml
<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="" LibraryVersion="" ApplicationName=".NET Library" xmlns="">
<StaticMethod TypeId="{9efa17eb-0d34-4f69-a085-5cc3f802439e}" Name="GetAvailableTagsForSite" Id="22">
<Parameter Type="String"></Parameter>
phillipharding / Get Term By Id from Group and Termset by Name
Created Jun 10, 2019
Get a Term by its ID with LocalCustomProperties from a Termgroup and Termstore by Name
View Get Term By Id from Group and Termset by Name
Content-Type: text/xml
<Request AddExpandoFieldTypeSuffix="true" ApplicationName=".NET Library" LibraryVersion="" SchemaVersion="" xmlns="">
<ObjectPath Id="48" ObjectPathId="47"/>
<ObjectIdentityQuery Id="49" ObjectPathId="47"/>
phillipharding / CreateListItemInAnotherSite.js
Created May 30, 2019
Create a ListItem in another site using the REST API
View CreateListItemInAnotherSite.js
(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 {
View GetCopyJobProgress - Polling Response Finishes when "JobState" = 0
accept: application/json;odata=verbose
content-type: application/json; odata=verbose
"copyJobInfo": {
"EncryptionKey": "6YIOwbP9/TSLiw6D0H+mvsiRbgjSvJLs5L28Pfx/0BQ=",
View CreateCopyJobs - Move Folder using SharePoint REST API
"NameConflictBehavior":0 = think means fail
"NameConflictBehavior":1 = think means replace
"NameConflictBehavior":2 = Rename at destination
Based on similar bejaviour at:
"IsMoveMode":true|false = if true the source folder is removed, otherwise it remains (copy)
View Get O365 Groups using Graph on Classic SP Page.js
(async function() {
function getAccessToken(resource) {
return new Promise( async (resolve, reject) => {
var body = {
"resource": resource || ""
const url = `${_spPageContextInfo.webAbsoluteUrl}/_api/SP.OAuth.Token/Acquire`;
const response = await fetch(url, {
phillipharding / Create Azure AD App Registration.ps1
Created Mar 19, 2019
Creates an Azure AD Application Registration with Client Secret using the Azure CLI
View Create Azure AD App Registration.ps1
param (
## Connecting to site
View AzureAD v1.0 On-Behalf-Of Grant
POST /{tenant id}/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
cache-control: no-cache
client_id:{client id}
client_secret:{client secret}
You can’t perform that action at this time.