Skip to content

Instantly share code, notes, and snippets.

View sebastienlevert's full-sized avatar
🦒

Sébastien Levert sebastienlevert

🦒
View GitHub Profile
@sebastienlevert
sebastienlevert / Get-SPOClientLibraries.ps1
Last active August 29, 2015 14:17
Lundis PowerShell #1 - Charger les librairies clientes
<#
.DESCRIPTION
Downloads the latest SharePoint Online Client Libraries (CSOM) from your SharePoint tenant.
Inspired by : http://modery.net/script-to-download-the-sharepoint-online-dlls/
.NOTES
Version : 1.0
Author : Sébastien Levert
Date : 2014/11/29
.PARAMETER OutputDirectory
The directory where to save all the files
@sebastienlevert
sebastienlevert / Connect-WithCredentials.ps1
Created March 30, 2015 05:29
Lundis PowerShell #2 - Installation du module PowerShell d'Office 365 PnP
Connect-SPOnline -Url https://tenant.sharepoint.com -Credentials (Get-Credential)
@sebastienlevert
sebastienlevert / Purge-SPOList.ps1
Created April 6, 2015 19:49
Purges a list from all its content
<#
.SYNOPSIS
Purge the content of a SharePoint list or library
.PARAMETER List
The List Object to purge the content from
.PARAMETER BatchSize
The BatchSize of the Query to the list
.PARAMETER Recycle
If this switch is On, the Purge recycles the items instead of deleting them
.EXAMPLE
#-----------------------------------------------------------------------
# Loads the Purge-SPOList Cmdlets
#-----------------------------------------------------------------------
. .\Purge-SPOList.ps1
#-----------------------------------------------------------------------
# Connects to your Office 365 SharePoint Online tenant
#-----------------------------------------------------------------------
Connect-SPOnline -Url https://<tenant>.sharepoint.com -Credentials <credentialslabel>
#-----------------------------------------------------------------------
# Loads the Purge-SPOList Cmdlets
#-----------------------------------------------------------------------
. .\Purge-SPOList.ps1
#-----------------------------------------------------------------------
# Connects to your Office 365 SharePoint Online tenant
#-----------------------------------------------------------------------
Connect-SPOnline -Url https://<tenant>.sharepoint.com -Credentials <credentialslabel>
#-----------------------------------------------------------------------
# Loads the Purge-SPOList Cmdlets
#-----------------------------------------------------------------------
. .\Purge-SPOList.ps1
#-----------------------------------------------------------------------
# Connects to your Office 365 SharePoint Online tenant
#-----------------------------------------------------------------------
Connect-SPOnline -Url https://<tenant>.sharepoint.com -Credentials <credentialslabel>
<#
.DESCRIPTION
Sets a field visibility (Display Form, New Form, Edit Form, Hidden)
.PARAMETER Field
The Field to modifiy its visibility settings
.PARAMETER ShowInDisplayForm
If we want the field to be visible in the DisplayForm
.PARAMETER ShowInNewForm
If we want the field to be visible in the NewForm
.PARAMETER ShowInEditForm
@sebastienlevert
sebastienlevert / gist:c895f007330fb17a24c2
Last active August 29, 2015 14:22
Execute-Set-FieldVisibility01.ps1
#-----------------------------------------------------------------------
# Loads the Set-Visibility Cmdlets
#-----------------------------------------------------------------------
. .\Set-FieldVisibility.ps1
#-----------------------------------------------------------------------
# Connects to your Office 365 SharePoint Online tenant
#-----------------------------------------------------------------------
Connect-SPOnline -Url https://<tenant>.sharepoint.com -Credentials <credentialslabel>
@sebastienlevert
sebastienlevert / Get-AccessToken.ps1
Last active May 1, 2021 05:11
Call Office 365 API Endpoints from PowerShell
<#
.DESCRIPTION
Gets an access token for an App-Only Azure AD Application
.PARAMETER TenantId
The TenantId of the Azure AD Application
Can be set globally with $global:AzureADApplicationTenantId
.PARAMETER ClientId
The ClientId of the Azure AD Application
Can be set globally with $global:AzureADApplicationClientId
.PARAMETER CertificatePath
$global:AzureADApplicationTenantId = "00000000-0000-0000-0000-000000000000"
$global:AzureADApplicationClientId = "00000000-0000-0000-0000-000000000000"
$global:AzureADApplicationCertificatePath = "C:\Certificate.pfx"
$global:AzureADApplicationCertificatePassword = "Password"
$exchangeResourceUri = "https://outlook.office365.com/";
. .\Get-AccessToken.ps1
. .\Is-Guid.ps1
$accessToken = Get-AccessToken -ResourceUri $exchangeResourceUri