Skip to content

Instantly share code, notes, and snippets.

View pkbullock's full-sized avatar
🎯
Focusing

Paul Bullock pkbullock

🎯
Focusing
View GitHub Profile
@pkbullock
pkbullock / Get-GraphCalls.ps1
Last active June 11, 2020 08:45
Making Graph calls with PnP PowerShell via App-Only Certificates
Connect-PnPOnline -ClientId "<AppId>" -CertificatePath "<C:\...\Cert\cerificate.pfx>" `
-CertificatePassword (ConvertTo-SecureString -AsPlainText "<pw>" -Force) `
-Url "https://<tenant>.sharepoint.com/sites/TheCoolTeam" -Tenant "<id>"
$token = Get-PnPGraphAccessToken
# Create header
$header = @{
Authorization = "Bearer $($token)"
}
@pkbullock
pkbullock / Update-WebUserLanguagePreference.ps1
Last active May 30, 2020 09:42
Change MUI Setting in SharePoint for User
Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<site>
Get-PnPListItem -List "User Information List" -Id 7 # Me
# -OR- #
$userEmail = "paul.bullock@mytenant.co.uk"
$CamlQuery = @"
<View>
<Query>
<Where>
@pkbullock
pkbullock / Transform with Terms.ps1
Last active April 11, 2020 20:49
Term Store Transformation Example Command
ConvertTo-PnPClientSidePage -Identity "Our-New-IT-Suite-Is-Mint.aspx" -PublishingPage `
-TargetConnection $spOnlineConn -Connection $sp13Conn `
-Overwrite `
-PageLayoutMapping C:\temp\Demo\onprem-news-mapping.xml `
-TermMappingFile C:\temp\Demo\termmapping.csv `
-LogType Console
@pkbullock
pkbullock / Export-Mapping-File.ps1
Last active April 11, 2020 20:47
Example of exporting the mapping file
$sp13Conn = Connect-PnPOnline http://portal2013/en -ReturnConnection
Export-PnPClientSidePageMapping `
-CustomPageLayoutMapping `
-PublishingPage "Our-New-IT-Suite-Is-Mint.aspx" `
-Folder "C:\temp\Blog" `
-Connection $sp13Conn
@pkbullock
pkbullock / PageLayoutMapping.xml
Last active April 11, 2020 20:26
Xml Fragment of Mapping File
<MetaData>
<Field Name="Title" TargetFieldName="" Functions="" />
<Field Name="IntranetKeywords" TargetFieldName="" Functions="" />
<Field Name="PublishingIsFurlPage" TargetFieldName="" Functions="" />
<Field Name="IntranetContentAuthor" TargetFieldName="" Functions="" />
<Field Name="IntranetContentPublishingDate" TargetFieldName="" Functions="" />
<!-- Managed Metadata field -->
<Field Name="IntranetContentCategory" TargetFieldName="IntranetContentCategoryMulti" Functions="" />
@pkbullock
pkbullock / Fragment.xml
Created April 1, 2020 16:09
PnP Provisioning English Regional Settings - Xml Fragment
<pnp:RegionalSettings AdjustHijriDays="0" AlternateCalendarType="None" CalendarType="Gregorian" Collation="25" FirstDayOfWeek="Monday" FirstWeekOfYear="2" LocaleId="2057" ShowWeeks="false" Time24="true" TimeZone="2" WorkDayEndHour="5:00PM" WorkDays="62" WorkDayStartHour="8:00AM" />
@pkbullock
pkbullock / Set-AppPage.ps1
Created January 7, 2020 11:32
Learning Pathways set app page
Connect-PnPOnline https://tenant.sharepoint.com/sites/LearningPortal/
Set-PnPClientSidePage -Identity Custom-Pack-Content -LayoutType SingleWebPartAppPage
@pkbullock
pkbullock / playlists.json
Created January 7, 2020 11:00
Demo playlists.json for the Learning Pathways
[
{
"Id": "a8cbac83-f7e8-45ff-a4a6-6b04f31a5745",
"Title": "Modern SharePoint Editing Experience",
"Image": "images/playlists/share_and_coauthor.png",
"LevelId": "a5522c84-14c5-4b36-b28e-9c6364837c98",
"AudienceId": "71ec9903-1498-49e2-8514-428e35617b18",
"TechnologyId": "a97cb2db-55fb-43ec-8ded-67909ce1c61f",
"SubjectId": "",
"Source": "Microsoft",
@pkbullock
pkbullock / guid-gen.ps1
Created January 7, 2020 10:49
Quick GUID generation and copy to clipboard
[System.Guid]::NewGuid().Guid | clip
@pkbullock
pkbullock / demo-fragment-metadata.json
Created January 7, 2020 10:38
Demo fragment metadata.json file for Learning Pathways
"Categories": [
{
"Id": "618da7fa-0ed2-4653-9dfd-271c3bbe3a44",
"Name": "Products",
"Image": "",
"TechnologyId": "",
"SubjectId": "",
"Source": "Microsoft",
"SubCategories": [