Skip to content

Instantly share code, notes, and snippets.

@joerodgers
joerodgers / Get-ListsWithOver5kItems.ps1
Created September 22, 2017 18:57
Display all lists in a SharePoint 2013+ farm that have >5k items
Get-SPSite -Limit All | Get-SPWeb -Limit All | ? { -not $_.IsAppWeb } | % {
foreach( $list in $_.Lists )
{
if( $list.ItemCount -gt 5000 )
{
[PSCustomObject] @{
WebUrl = $list.ParentWeb.Url
List = $list.Title
ListUrl = $list.ParentWeb.Site.MakeFullUrl($list.DefaultViewUrl)
@joerodgers
joerodgers / ConvertTo-CsvFromExcelWorksheet.ps1
Last active September 26, 2017 17:16
Export Excel Worksheet to CSV
function ConvertTo-CsvFromExcelWorksheet
{
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)][string]$ExcelFilePath,
[Parameter(Mandatory=$true)][string]$CsvFilePath,
[Parameter(Mandatory=$false)][string]$Worksheet = "Sheet1"
)
@joerodgers
joerodgers / Download-FileFromSPO.ps1
Last active May 4, 2023 06:17
Download a File From SharePoint Online Document Library
Add-Type -Path "C:\O365_CSOM\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\O365_CSOM\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll"
function Download-File
{
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)][Microsoft.SharePoint.Client.ClientContext]$ClientContext,
[Parameter(Mandatory=$true)][System.Uri]$FileUri,
@joerodgers
joerodgers / postListDataToRemoteService.js
Last active September 26, 2017 17:17
Post List Data to Remote Service
<script type="text/javascript">
function PreSaveAction() // native sharepoint method for data validation
{
if( $('input[title="Post to External Service"]')[0].checked )
{
var data = getData();
console.log(data);
@joerodgers
joerodgers / Get-AADUserLicenseInfo.ps1
Created September 11, 2017 18:11
Get-AADUserLicenseInfo.ps1
<#
This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.
THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object
code form of the Sample Code, provided that you agree:
(i) to not use our name, logo, or trademarks to market your software product in which the sample code is embedded;