Skip to content

Instantly share code, notes, and snippets.

@BLumbye
BLumbye / ListAllFormulas.bas
Created April 7, 2023 11:56
VBA Module that lists all formulas in a Workbook. Based on http://www.vbaexpress.com/kb/getarticle.php?kb_id=409
Option Explicit
Sub ListAllFormulas()
Dim sht As Worksheet
Dim shtName
Dim myRng As Range
Dim newRng As Range
Dim c As Range
@rajivrajvat
rajivrajvat / SharePoint Rest API Endpoints
Created February 5, 2023 07:08
SharePoint REST API has a large number of endpoints that allow you to interact with SharePoint data. Some of the common endpoints include:
Sites - /_api/web/sites - Access information about the SharePoint sites in your organization.
Lists - /_api/web/lists - Access information about the lists in a site.
List Items - /_api/web/lists/getbytitle('list_title')/items - Access specific items in a list.
Users - /_api/web/siteusers - Access information about users in a site.
Content Types - /_api/web/contenttypes - Access information about the content types in a site.
Fields - /_api/web/lists/getbytitle('list_title')/fields - Access information about the fields in a list.
Folders - /_api/web/lists/getbytitle('list_title')/folders - Access information about the folders in a document library.
Files - /_api/web/lists/getbytitle('list_title')/files - Access information about the files in a document library.Views - /_api/web/lists/getbytitle('list_title')/views - Access information about the views in a list.
Taxonomy - /_api/web/taxonomy - Access information about the taxonomy term sets in a site.
Permissions - /_api/web/lists/getbytitle('list_title')/roleas
@scale-tone
scale-tone / gist:99db373b257e982c76af97e715a542d6
Last active June 18, 2024 15:16
Create a token for MS Project Online
static async Task<string> GetTokenForMsProjectOnline()
{
var aadApp = PublicClientApplicationBuilder
.Create(AadAppClientId)
.WithTenantId(TenantId)
.WithRedirectUri("http://localhost")
.Build();
// It is essential to provide a token cache for this scenario,
// otherwise .AcquireTokenSilent() will never succeed, and the code will keep asking users to re-authenticate.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" ></script>
<h1>Training Announcements</h1><br/>
<div id="result"></div>
<script>
var LoginName=_spPageContextInfo.userEmail;
var newURL="/_api/Web/Lists/GetByTitle('TrainingAnnouncements')/Items?$select=Title,ID,Author/EMail&$filter=Author/EMail eq '"+ LoginName +"'&$expand=Author/Id";
jQuery().ready(function () {
function getItems(url) {
return $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + url,
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<!--External js file to get data from SharePoint List -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.jqueryui.min.css">
</head>
<body>
<div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(function(){
$("#btnGetTrainingRequests").click(function(){
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('TrainingRequests')/items?$select=Title,Course,TrainingType,Comments,TrainerName/EMail,TrainerName/FirstName,TrainerName/LastName&$expand=TrainerName";
$.ajax({
url: requestUri,
type: "GET",
headers: {
"accept":"application/json; odata=verbose"
<h2>Update SharePoint List using Rest API in SharePoint Online or SharePoint 2016/2013</h2>
<br/>
<table>
<tr>
<td>Enter Old List Title:</td>
<td><input type="text" id="txtOldTitle" size="40"/></td>
</tr>
<tr>
<tr>
<td>Enter New List Title:</td>
@lucasmonteverde
lucasmonteverde / sharepoint-wheel-zoom.js
Last active July 7, 2023 13:38
Add Sharepoint pdf viewer zoom with scroll wheel
// ==UserScript==
// @name Sharepoint wheel zoom
// @namespace https://gist.githubusercontent.com/lucasmonteverde/3b2f2ef847c05d4625e7f1a5866b1ef9/raw/sharepoint-wheel-zoom.js
// @version 0.1
// @description Add Sharepoint pdf an way to zoom with scroll wheel
// @author @lucasmonteverde
// @match https://*.sharepoint.com/*pdf*
// @icon https://upload.wikimedia.org/wikipedia/commons/e/e1/Microsoft_Office_SharePoint_%282019%E2%80%93present%29.svg
// @grant none
// ==/UserScript==
@sancarn
sancarn / UpdatingSharepointRESTExample.js
Created November 29, 2022 20:25
Simple script to update sharepoint using the REST API
//Note: When porting `Authorization: "Bearer " + accessToken` will also be required in all headers!
/*
* Get all fields of a list
* @param {string} site - Url of site
* @param {string} list - Title of list
* @example await getListFields("https://myServer.sharepoint.com/sites/my/sharepoint/site", "My list name")
* @docs https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest
*/
async function getListFields(site, list){
public async Task<ICollection<PublishedProject>> GetApplicableProjectsAsync()
{
var projectContext = GetProjectContext();
const int PROJECT_BLOCK_SIZE = 20;
projectContext.Load(projectContext.Projects, ps => ps.Include(p => p.Id));
await projectContext.ExecuteQueryAsync();
var allIds = projectContext.Projects.Select(p => p.Id).ToArray();