Skip to content

Instantly share code, notes, and snippets.

param(
[Parameter(Mandatory = $true)]
[string]$ListTitle,
[Parameter(Mandatory = $true)]
[int]$ItemId,
[Parameter(Mandatory = $true)]
[string]$Path
)
@vaderj
vaderj / SP-New-Item-Form-Edits.js
Last active June 11, 2018 20:39
SharePoint new list item form - reading / hiding to fields with JavaScript / jQuery #Javascript #SharePoint
//Lookup Column: Allow multiple values
// jQuery Select:
jQuery("select[title='Vehicle']") ;
// read selected options
jQuery("select[title='Vehicle'] option:selected").text() ;
// Hide one of the OPTIONS in the drop down selector (addressed via value, NOT text):
jQuery("select[title='Vehicle'] option[value='2']").remove()
// Hide the field and its label from view
jQuery("select[title='Vehicle']").closest('tr').hide()
@vman
vman / spfxPOST.ts
Last active September 19, 2022 15:48
Making a POST request to SharePoint from an SPFx webpart
private _makePOSTRequest(): void {
const spOpts: ISPHttpClientOptions = {
body: `{ Title: 'Developer Workbench', BaseTemplate: 100 }`
};
this.context.spHttpClient.post(`${this.context.pageContext.web.absoluteUrl}/_api/web/lists`, SPHttpClient.configurations.v1, spOpts)
.then((response: SPHttpClientResponse) => {
// Access properties of the response object.
console.log(`Status code: ${response.status}`);
@vman
vman / Set.Mult.UserProfileProperty.js
Last active May 16, 2019 17:01
SharePoint Online: Set Mutli Value User Profile property with REST API
(function ($) {
'use strict';
var requestHeaders = {
'X-RequestDigest': $("#__REQUESTDIGEST").val(),
"accept": "application/json; odata=nometadata",
"content-type": "application/json;odata=nometadata"
};
var userData = {
@hsiboy
hsiboy / FastLED_AnalogueInputColour.ino
Last active April 21, 2024 19:49
FastLED - Using a potentiometer to control Colour, brightness and speed.
//FastLED_AnalogueInput.ino
/*
Using a potentiometer to control colour, brightness and speed.
Wire up as per http://arduino.cc/en/Tutorial/AnalogInput
You can connect the wiper, to any analogue input pin, and
adjust the settings below.
You will need three 10k potentiometers.
*/
# SYNTAX:
var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches)
var pattern = /pattern/attributes; # same as above
# BRACKETS:
[...]: Any one character between the brackets.
[^...]: Any one character not between the brackets.