Skip to content

Instantly share code, notes, and snippets.

@glapointe
glapointe / Get-SPControlElement.ps1
Created January 19, 2017 17:27
Retrieves the control elements registered for a given delegate control ID.
<#
.Synopsis
Retrieves the control elements registered for a given delegate control ID.
.DESCRIPTION
Retrieves the control elements registered for a given delegate control ID.
.EXAMPLE
Get-SPControlElement -Web "http://demo" -ControlId "QuickLaunchDataSource" -TopOnly
.EXAMPLE
Get-SPControlElement -Web "http://demo" -ControlId "QuickLaunchDataSource" -Scope "Web"
#>
function Get-SPUserEffectivePermissions() {
[CmdletBinding(DefaultParameterSetName="Farm")]
param (
[Parameter(Mandatory=$true, Position=0)]
[ValidateNotNull()]
[object[]]$users,
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=1)]
[ValidateNotNull()]
[Microsoft.SharePoint.SPSecurableObject]$InputObject
@glapointe
glapointe / Custom Windows PowerShell Function to Make SharePoint REST Service Calls (Alternate Version)
Last active August 29, 2015 14:18
Sends an HTTP or HTTPS request to a SharePoint Online REST-compliant web service using Windows PowerShell.
The functions in this Gist are part of an article series on ITUnity.com.
@glapointe
glapointe / Custom Windows PowerShell Function to Make SharePoint REST Service Calls
Last active May 1, 2020 18:00
Sends an HTTP or HTTPS request to a SharePoint Online REST-compliant web service using Windows PowerShell.
The functions in this Gist are part of an article series on ITUnity.com.
@glapointe
glapointe / Connect-SPOSite.ps1
Created March 31, 2015 20:51
Utility function for connecting to a SharePoint Online Site Collection using the SharePoint CSOM API and PowerShell.
function global:Connect-SPOSite {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
$Url
)
begin {
[System.Reflection.Assembly]::LoadFile("C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll") | Out-Null
[System.Reflection.Assembly]::LoadFile("C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll") | Out-Null
@glapointe
glapointe / Load-CSOMProperties.ps1
Created March 31, 2015 20:28
Utility PowerShell function that facilitates the loading of specific properties of a Microsoft.SharePoint.Client.ClientObject object or Microsoft.SharePoint.Client.ClientObjectCollection object.
<#
.Synopsis
Facilitates the loading of specific properties of a Microsoft.SharePoint.Client.ClientObject object or Microsoft.SharePoint.Client.ClientObjectCollection object.
.DESCRIPTION
Replicates what you would do with a lambda expression in C#.
For example, "ctx.Load(list, l => list.Title, l => list.Id)" becomes
"Load-CSOMProperties -object $list -propertyNames @('Title', 'Id')".
.EXAMPLE
Load-CSOMProperties -parentObject $web -collectionObject $web.Fields -propertyNames @("InternalName", "Id") -parentPropertyName "Fields" -executeQuery
$web.Fields | select InternalName, Id