Tuesday, 14 April 2020

Top tips on teams for remote workers

Some cool pointers to remember on teams from typcial remote users:

  1. Using commands in the search box "/"
  2. Utilising multiple cloud storage options including drop box etc.
  3. You can blurr out your background. :)
  4. There are tonnes of app available.

#phildoesteams

Thursday, 2 April 2020

Creating SharePoint Document Library folders with a specific Content Type and metadata

A script that demonstrates how to create lots of folders in a document library with a specific content type and metadata. This approach uses pnp.

#Folder script to provision yearly folders with specific content type and metadata.
#Note this will also update existing folders

#Connect to tenant
Connect-PnPOnline -url https://mytenant.sharepoint.com/sites/SiteCol -UseWebLogin
$years = @("2020","2019","2018","2017","2016","2015","2014","2013","2012","2011","2010") 

function Provision-YearlyFolders {
        Param($folderName)
        #Get folder
        $query = "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>"+ $folderName +"</Value></Eq></Where></Query></View>"

        $folder = Get-PnPListItem -List incident -Query $query

         #Create folder if it doesnt exist
         if(!$folder) {
                 Add-PnPFolder -Name
                 $folderName -Folder incident
                 $folder = Get-PnPListItem -List incident -Query $query
         }
         #Update content type and set year order column
         Set-PnPListItem -List incident -Identity
         $folder.Id -ContentType "Yearly Folder" -Values @{"YearSortOrder" = $folderName}
         Write-Host "Provisioned" $folderName
}
#loop through yearly folders
foreach($year in $years)
{
    Provision-YearlyFolders $year
}