This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-CsvFromExcelWorksheet | |
{ | |
[cmdletbinding()] | |
param | |
( | |
[Parameter(Mandatory=$true)][string]$ExcelFilePath, | |
[Parameter(Mandatory=$true)][string]$CsvFilePath, | |
[Parameter(Mandatory=$false)][string]$Worksheet = "Sheet1" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$results = @() | |
Get-SPSite -Limit All | ? { -not $_.IsReadLocked } | Get-SPWeb -Limit All | ? { -not $_.IsAppWeb } | % { | |
if( $_.webTemplate -ne "STS" -and $_.WebTemplate -ne "SPSPERS" ) | |
{ | |
$totalItemCount = 0 | |
# total the item counts in all the visible lists | |
$_.Lists | ? { -not $_.Hidden } | % { $totalItemCount += $_.ItemCount } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$site = "https://contoso.sharepoint.com/sites/publishing-site" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll" | |
function Get-HtmlDesignFeatureProperties | |
{ | |
[cmdletbinding()] | |
param |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Office365UrlandIPAddressUpdates | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$false)][int]$Days = -7 | |
) | |
begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM | |
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" | |
$credential = Get-Credential -Message "SharePoint Online Site Administrator" | |
$context = New-Object Microsoft.SharePoint.Client.ClientContext( "https://contoso.sharepoint.com/sites/teamsite" ) | |
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credential.UserName, $credential.Password) | |
$context.Load($context.Site.RootWeb.AllProperties) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell | |
# prevent issues with the SharePoint API certificate validation procedures (must be after loading sharepoint snapin) | |
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} | |
function Add-FormsAuthRequestHeader | |
{ | |
param | |
( | |
[Parameter(Mandatory=$true)][Object]$ClientContext |
OlderNewer