Friday, 9 June 2023

SharePoint Document Library Folder Metadata Extract using PNP PowerShell

I recently was asked to extract lots of metadata from one of our SharePoint solutions. The ask was the following:
  • Find all folders within a document library with a particular content type (folders are always at the root of the library.
  • For each folder, extract specific metadata fields (ergo get Folder metadata) including managed metadata fields.
  • Export the information to csv
The main reason I decided to post this was that I couldn't find a good example of extracting custom metadata fields from a Folder Content Type item.

This solution is based on PNP. It is fairly crude (no error handling) but does the job.

Aside, this script works with PnP.PowerShell version 1.9.0. My colleague tried it with an older version and it was unable to get the Managed Metadata Column labels.

#Folder content type name "My Folder Content Type"

#Get the following folder fields
#FolderFieldText1
#FolderFieldText2
#FolderFieldManagedMetadata1
#FolderFieldManagedMetadata2

#########################################
#Set following three variables before run
$siteUrl ="https://mytenant.sharepoint.com/sites/site 1/"  
$libraryName = "Documents"
$csvLocation = "C:\FolderMetadataExport.csv"
#########################################

#Add folder header
$folderHeader = "Path,Title,Folder Field Text1,Folder Field Text2,Folder Field Managed Metadata 1,Folder Field Managed Metadata 2,"
Add-Content -Path $csvLocation -Value $folderHeader

Connect-PnPOnline -url $siteUrl -UseWebLogin
$items = Get-PnPListItem -List $libraryName -Query "<View><ViewFields><FieldRef Name='FolderFieldText1'/><FieldRef Name='FolderFieldText2'/><FieldRef Name='FolderFieldManagedMetadata1'/><FieldRef Name='FolderFieldManagedMetadata2'/></ViewFields><Query><Where><Eq><FieldRef Name='ContentType'/><Value Type='Text'>My Folder Content Type</Value></Eq></Where></Query></View>"
foreach($item in $items){
    
    $folderInfo = '"'
    $folderInfo += $item.FieldValues.FileRef
    $folderInfo += '","'
    $folderInfo += $item.FieldValues["Title"]
    $folderInfo += '","'
    $folderInfo += $item.FieldValues["FolderFieldText1"]
    $folderInfo += '","'
    $folderInfo += $item.FieldValues["FolderFieldText2"]
    $folderInfo += '","'
    $folderInfo += $item.FieldValues["FolderFieldManagedMetadata1"].Label
    $folderInfo += '","'
    $folderInfo += $item.FieldValues["FolderFieldManagedMetadata2"].Label
    $folderInfo += '",'
    $folderInfo
    #Apend to csv
    Add-Content -Path $csvLocation -Value $folderInfo
}     

Wednesday, 14 September 2022

M365 Fundamentals - Another certification.

These posts are few and far between at the moment. It is strange as I have lots of ideas I would like to get down but never get the time to put in to action. Anyway. Another Cert done last month. This one was the Microsoft 365 Fundamentals. After 18 years working with these technologies I sometimes question if Microsoft exams are really that required but I have to say I did learn a few things from it so worth getting in when I can find the time. https://docs.microsoft.com/en-us/certifications/exams/ms-900 Thanks all

Thursday, 15 July 2021

Certification time

Well it has been a while since I list did some certifications. Mainly due to being so busy delivering solutions for customers. Hey we have to keep the money coming in right? Anyway I managed to get a bit of time this week and managed to completed two Exams. I even got a couple of badges for it haha.

Monday, 14 June 2021

SharePoint _layouts urls

A handy quick reference to those _layouts pages in sharepoint :) https://www.concurrency.com/blog/april-2016/helpful-sharepoint-urls#:~:text=Helpful%20SharePoint%20URLs%20%26%20Site%20Locations%20%20,%20%20%2F_layouts%2Fuser.aspx%20%2033%20more%20rows%20

Thursday, 21 January 2021

Visual Studio Team Explorer buttons missing

Hello world,

I had an issue the other day where I was missing options in team explorer when trying to connect to dev ops. 

All the fun stuff wasnt there like:
  • Branches
  • Sync
  • Pull requests etc
It looked like this...

If you go to "Tools" then "Options" and search for "Preview features" there is an option for "New git user experince". This must be unchecked.


Once unselected you will get this:


This took me a while to work out despite it staring me directly in the face so thought I would share :)

Monday, 13 July 2020

This article clearly outlines what the prefered Microsoft approach is with respect to authentication within SharePoint Online....that being to use "Azure AD application registration".

(Over "SharePoint App only" or any of the legacy approaches using user names and passwords from key vaults or config files)

One further point to note to perhaps the less experienced out there, is that you must always consider your customer. Just because microsoft have a new way of doing it, that doesnt mean that the customer estate will want you to use that approach. Its important to run these sorts of things past the customer before you build it negate the risk of reengineering it in the future. Obvsiouly you will present the most modern approach but perhaps there are limitations as to why they cant do it. :) https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly

Friday, 5 June 2020

My Client list to date

I wanted to create a post which contains the majority of my client work to date so here it is.  It doesnt include any of the internal strategy, mentoring or practice development activities out side of paid for work but it is nice to see where I have been hehe.

(July 23 – Oct 23) Microsoft 365 Solution Architect – The Environment Agency - Permit classification system - Microsoft 365 / SharePoint Online / PowerBi
(May 23 – July 23) Microsoft 365 Solution Architect – The Environment Agency - Permit classification system Managed Service coverage - Microsoft 365 / SharePoint Online
(Mar 23 – April 23) Principal Consultant – Vehicle Certification Agency - Digital Transform Consultancy- Microsoft 365 / SharePoint Online / Teams / Purview
(Sept 22 – Feb 23) Microsoft 365 Solution Architect / Team Lead – The Environment Agency - Permit classification system Continuous Improvement Phase 2022 - Microsoft 365 / SharePoint Online
(July 21 – Jun 22) Microsoft 365 Solution Architect / Team Lead – Quilter Wealth Management - Intranet / M365 Develooment Pracitce Framework - Microsoft 365 / SharePoint Online / Microsoft Teams / OneDrive / Forms
(Jan 20 – July 21) Microsoft 365 Solution Architect / Team Lead – The Environment Agency - Permit classification System - Microsoft 365 SharePoint Online / Azure 
(July 19 – Jan 20) Solution Architect / Principal Consultant  – Air / Rail Accidents Investifation Branch - Document Management solution for Incident Management system - Microsoft 365 SharePoint Online / Dynamics 365
(July 19 – Dec 19) Technical Architect – Thames Valley Police - Farm installation - SharePoint Server2019 (hosted in Azure)
(Oct 18 – Jul 19) Solution Architect – Kew Gardens - EDRM - SharePoint Online / Azure
(Dec 17 – Sep 18) Solution Architect – Surrey and Sussex Police - Intranet - SharePoint Server 2013
(Jul 17 – Nov 17) Solution Architect – Security Industry Authority - Corporate website / Custom application update - SharePoint Server 2007 - 2010
(Sep 16 – Jun 17) Solution Architect – Surrey and Sussex Police - Migration - Multiple applications to SharePoint Server 2013
(Nov 15 – Sep 16) Solution Architect – ACAS - Document Management / Collaboration - Office 365 (SharePoint / One Drive)
(May 15 – Nov 15) Solution Architect – Kew Gardens - EDRMS - Office 365 (SharePoint) / Azure
(Aug 14 – May 15) Solution Architect – Nationwide Building Society - Search Enhancements - SharePoint server 2013 
(Aug 14 – May 15) Principal consultant – Nationwide Building Society - Design appraisal - SharePoint Server 2013
(Mar 14 – Jul 14) Solution Architect / Principal Consultant – Department of Energy & Climate Change - EDRM - SharePoint Online
(Nov 13 – Feb 14) Solution Architect / Principal Consultant – Surrey Police - Migration - OpenText to SharePoint 2013
(Sep 13 – Oct 13) Solution Architect / Principal Consultant – HM Treasury - Staff Changes HR SharePoint application Enhancements - SharePoint 2010
(Aug 13 – Aug 13) Solution Architect / Principal Consultant – PepsiCo UK - Migration - SharePoint 2010
(Aug 13 – Aug 13) Solution Architect / Principal Consultant – Maverick TV - Document Management - SharePoint 2010
(Mar 13 – May 13) Solution Architect / Principal Consultant – Medimmune - Collaboration platform - SharePoint 2010
(Mar 13 – May 13) Solution Architect / Principal Consultant – The Electoral Commission - Document Management Archival - SharePoint 2010
(Jun 12 – Mar 13) Technical Architect / Team Lead – HM Treasury - Staff Changes HR SharePoint application - SharePoint 2010
(Dec 12 – Feb 13) Principal SharePoint Consultant – Home Office - EDRM - SharePoint 2010
(Oct 12 – Nov 12) Technical Architect / Senior Consultant – The Electoral Commission - Document Management enhancements - SharePoint 2010
(Mar 12 - Mar 12) Senior SharePoint Consultant – Mencap - Health check - SharePoint 2010
(Jun 11 – Oct 11) Senior SharePoint Consultant - Home Office - SharePoint 2010
(May 10 – Mar 12) Senior SharePoint Consultant / Architect / Team lead - Carbon Trust - Public facing website - SharePoint 2010
(Apr 11 – Jul 11) Senior consultant / Lead developer - Electoral Commission - Intranet - SharePoint 2010
(Mar 11 – Jul 11) Senior consultant / architect - Energy Saving Trust - Extranet - Development in SharePoint 2010
(May 10 – Jul 10) SharePoint Training Consultant - Vehicle Certification Agency - SharePoint 2010
(Sep 09 - May 10) Technical Architect - Heritage Lottery Fund - Public Facing Website - SharePoint 2007
(Oct 09 – Dec 09) Senior Consultant - London Pension Fund Authority - Intranet SharePoint 2007 
(Nov 07 - Oct 09) Lead Developer - ACAS and Central Arbitration Committee - Public Facing Websites - GOSS iCM
(Sep 07 – Nov 07) Developer - Roffey Park - Public Facing Website - SharePoint 2007
(Jan 07 – Mar 07) Developer - National Heritage Memorial Fund - Website Development - SharePoint 2007
(Dec 05 - Jan 07) Developer - Security Industry Authority - Licensing Database - Content Management Server 2002
(Feb 05 - Dec 05) Junior Developer - Heritage Lottery Fund - Public Facing Website - Content Management Server 2002
(Sep 04 - Feb 05) Junior Developer - Security Industry Authority - Public Facing website - Content Management Server 2002
(Jul 04 - Sep 04) Junior Developer - Veterinary Laboratory Authority - Bespoke .net Application