This file contains hidden or 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
//getRequest method reference | |
//https://gist.github.com/ktskumar/a9e9df497673e9fd26ead8532b9ff425 | |
//Get the Request location from the browser URL | |
var path = location.href.replace(location.search, "") + "?as=json"; | |
if (!window._isSPSitePage) //Validate the current page not a modern Site Page | |
console.log("User ID: " + _spPageContextInfo.aadUserId + " - Tenant ID: " + _spPageContextInfo.aadTenantId); | |
else { // If the current page is modern page |
This file contains hidden or 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
//getRequest method reference | |
//https://gist.github.com/ktskumar/a9e9df497673e9fd26ead8532b9ff425 | |
//Returns the current user information | |
getRequest("https://domain.sharepoint.com/sites/name/_api/web/currentuser").then(function(output){ | |
console.log(JSON.parse(output.response)); | |
}); | |
//Returned Properties | |
//Email, Expiration, Id, IsEmailAuthenticatonGuestUser, IsHiddenInUI, IsShareByEmailGuestUser, IsSiteAdmin, LoginName, |
This file contains hidden or 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
//getRequest method reference | |
//https://gist.github.com/ktskumar/a9e9df497673e9fd26ead8532b9ff425 | |
//Returns the profile and ms graph related user information | |
getRequest("https://domain.sharepoint.com/sites/webname/_api/SP.Directory.DirectorySession/GetGraphUser(principalName='[email protected]')") | |
.then(function(output){ | |
console.log(JSON.parse(output.response)); | |
}); | |
//Returned Properties |
This file contains hidden or 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
{ | |
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", | |
"elmType": "div", | |
"txtContent": "@currentField", | |
"customCardProps": { | |
"formatter": { | |
"elmType": "img", | |
"style": { | |
"max-width": "250px" | |
}, |
This file contains hidden or 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
// XMLHttpRequest to process get requests | |
function getRequest(url) { | |
var request = new XMLHttpRequest(); | |
return new Promise(function(resolve, reject) { | |
request.onreadystatechange = function() { | |
if (request.readyState !== 4) return; | |
if (request.status >= 200 && request.status < 300) { | |
resolve(request); | |
} else { |
This file contains hidden or 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
function getRequest(url) { | |
var request = new XMLHttpRequest(); | |
return new Promise(function(resolve, reject) { | |
request.onreadystatechange = function() { | |
if (request.readyState !== 4) return; | |
if (request.status >= 200 && request.status < 300) { | |
resolve(request); | |
} else { | |
reject({ | |
status: request.status, |
This file contains hidden or 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
//Try this code in Microsoft Power Automate Home page | |
function getRequest(url) { | |
var request = new XMLHttpRequest(); | |
return new Promise(function(resolve, reject) { | |
request.onreadystatechange = function() { | |
if (request.readyState !== 4) return; | |
if (request.status >= 200 && request.status < 300) { | |
resolve(request); | |
} else { |
This file contains hidden or 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
Write-host 'ensure logged in' | |
$m365Status = m365 status | |
if($m3656Status -eq "Logged Out"){ | |
m365 login | |
} | |
#Initialize variables | |
$siteUrl ='https://contoso.sharepoint.com' | |
$library ='Documents' |
This file contains hidden or 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
#Export all lists properties (Specified in $listProperties variable) from the SharePoint in to CSV format | |
### | |
$outputfilepath = "<PUTYOURPATHHERE.csv>" | |
$weburl = "https://contoso.sharepoint.com/" | |
# Provide List Properties in below variable | |
$listProperties = @('Title', 'Url', 'Id') | |
### | |
Write-host 'ensure logged in' | |
$m365Status = m365 status | |
if ($m365Status -eq "Logged Out") { |
This file contains hidden or 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
Execute in bash | |
----------------------- | |
npm un -S @types/webpack-env @types/es6-promise | |
npm un -D @types/chai @types/mocha | |
npm i -SE @microsoft/[email protected] @microsoft/[email protected] @microsoft/[email protected] @microsoft/[email protected] @microsoft/[email protected] | |
npm i -DE @microsoft/[email protected] @microsoft/[email protected] @microsoft/[email protected] @microsoft/[email protected] [email protected] @microsoft/[email protected] @types/[email protected] @types/[email protected] | |
npm dedupe | |
rm ".editorconfig" | |
./config/copy-assets.json |