Skip to content

Instantly share code, notes, and snippets.

View navarrorc's full-sized avatar

Roberto C Navarro navarrorc

View GitHub Profile
/*
Hit 'ctrl + d' or 'cmd + d' to run the code, view console for results
*/
import { sp } from "@pnp/sp/presets/all";
(async () => {
console.clear()
const list = sp.web.lists.getByTitle("CB_Progress")
const items = await list.items.getAll()
@navarrorc
navarrorc / gist:b48cf279457fea1a4af77cc5b72f5f83
Created March 30, 2020 16:42
Sample Runbook written in powershell
param(
[OutputType([string[]])]
[Parameter(Mandatory=$true)]
[string]
$SPOSiteUrl
)
Connect-PnPOnline -url $SPOSiteUrl -AppId 05f5eb20-13c1-4ce6-a992-bf697f03740a -AppSecret iCdfbFvD/mzkxvOH2JgY1afbZ6mf0zaDK+W3uzaNs8o=
@navarrorc
navarrorc / gist:243acde42c11fd5ea4126ab2c705c440
Created March 30, 2020 16:37
Request Body JSON Schema (Flow)
{
"type": "object",
"properties": {
"webUrl": {
"type": "string"
},
"webDescription": {
"type": "string"
},
"creatorName": {
@navarrorc
navarrorc / script.js
Created March 12, 2020 21:24
Create SharePoint List
const listName = "My_New_List"; //<== Update the listName
const listDescription = "Description of why the List exists";
// using @pnp/sp
import { sp } from "@pnp/sp/presets/all";
// Add List
// create list
async function createList(){
const listAddResult = await sp
@navarrorc
navarrorc / script.js
Created March 12, 2020 21:15
Create List fields using pnpjs
const textFields = [
"fieldName1",
"fieldName2",
"fieldName3"
]
const listName = "My_List_Name"; //<== Update the listName
// using @pnp/sp
import { sp } from "@pnp/sp/presets/all";
me/settings('contributionToContentDiscoveryDisabled')
{6cadb877-5488-4b33-b19f-3bf6c53befb7}/settings('contributionToContentDiscoveryDisabled')
// Write a function that takes a URL like: test.com/post/12xy5id-hello-and-welcome
// And converts it into "Hello and Welcome".
// - Don't include tokens that start with numbers
// - If a token is 3 characters or less, don't capitalize it
function outputMessage(input) {
const tempArray = input.split('-'); //['12..', 'hello', 'and', 'welcome']
let finalArray = [];
This file has been truncated, but you can view the full file.
(window["noconflictJsonp"] = window["noconflictJsonp"] || []).push([["vendors~main"],{
/***/ "./node_modules/@pnp/common/dist/common.es5.js":
/*!*****************************************************!*\
!*** ./node_modules/@pnp/common/dist/common.es5.js ***!
\*****************************************************/
/*! exports provided: AdalClient, SPFxAdalClient, objectToMap, mergeMaps, setup, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, mergeOptions, FetchClient, BearerTokenFetchClient, PnPClientStorageWrapper, PnPClientStorage, getCtxCallback, dateAdd, combine, getRandomString, getGUID, isFunc, objectDefinedNotNull, isArray, extend, isUrlAbsolute, stringIsNullOrEmpty, getAttrValueFromString, sanitizeGuid, jsS, hOP, getHashCode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var executeModules = data[2];
/******/
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [];
@navarrorc
navarrorc / GetSiteScriptFromList.js
Created March 18, 2019 21:29
GetSiteScriptFromList
// see: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-rest-api#getsitescriptfromlist
function RestRequest(url,params) {
var req = new XMLHttpRequest();
req.onreadystatechange = function ()
{
if (req.readyState != 4) // Loaded
return;
console.log(JSON.parse(req.responseText).value);
};