Skip to content

Instantly share code, notes, and snippets.

View PokerGuy's full-sized avatar

Evan Zlotnick PokerGuy

View GitHub Profile
@PokerGuy
PokerGuy / gist:5cdfc4ef146ce6b535bfd8e13469a2ab
Last active June 4, 2024 08:48
Push a file to SharePoint
const push = async (file, fileName) => {
const client = new aws.SecretsManager();
const spURL = `https://<your site>.sharepoint.com/sites/<your specific subsite>/_api/web/GetFolderByServerRelativeUrl('Documents')/Files/Add(url='${fileName}', overwrite=true)`;
try {
const data = await client.getSecretValue({ SecretId: '<whatever you called your secret>' }).promise();
const secret = JSON.parse(data.SecretString).<whatever you called your secret>;
const getToken = await axios.post('https://accounts.accesscontrol.windows.net/<sharepoint resource id>/tokens/OAuth/2',
querystring.stringify({
grant_type: 'client_credentials',
client_id: '<ask your sharepoint person for this it's a something@tenant id>',

Keybase proof

I hereby claim:

  • I am pokerguy on github.
  • I am ezlotnick (https://keybase.io/ezlotnick) on keybase.
  • I have a public key ASDqpdCUzoqSKYru162Vtv_t0uELVSkLYUTVUIMkmR90Pwo

To claim this, I am signing this object:

# HTTP - redirect all requests to HTTPS:
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
# HTTPS - proxy requests on to local Node.js app:
server {
listen 443;