Skip Ribbon Commands
Skip to main content
 

 Follow Me

 
 
 
 
 

 SharePoint Blog List

 
  
  
  
  
  
  
  
  
  
  
  
  
Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog
What's going on with TK.
October 31
Reversing Arrays easily in PowerShell

I was recently dealt a fun task from a customer. They had a site in SharePoint that had a few links in the Quick Launch (left nav, quick nav, whatever) and they wanted to copy the Quick Launch from another site to it. They wanted to keep the existing links below the new ones. Here are some pictures to help it all make sense:

I want to copy these links:

image

and put them on top of these links on another site.

image

Of course I immediately thought of your friend and mine, the PnP PowerShell for this task. Sure enough, there are cmdlets for that, Get-PnPNavigationNode and Add-PnPNavigationNode. Just what the doctor ordered.

Add-PnPNavigationNode is pretty basic and I had to work a bit to get exactly what the customer wanted. When you add a Navigtation node with Add-PnPNavigationNode it puts it at the end of the list, which makes sense. You can also throw the switch parameter, –First, to put it at the top. In most situations that probably is fine, but mine was tricky. I didn’t want to put the copied nav nodes at the end, I wanted the existing ones to stay there. I also couldn’t just add them all as –First because then they would end up at the top, but in backwards order. When I get the old nav nodes with Get-PnPNavigationNode it returns them in their correct order, so as I walked through them with Foreach the first one would be added on top, but then the second one, also with the –First switch, would end up on top, and so on. Enter [array]::Reverse.

The Array class in PowerShell has quite a few tricks up its sleeve in the form of operations, and Reverse is one of them. If you want to see the rest, go to this page, or type [array]:: in a PowerShell host and tab through the list. It’s quite impressive. 

Here’s what my code looked like:

$oldsiteurl = “https://contoso.sharepoint.com/sites/8884aced
$newsiteurl = “https://contoso.sharepoint.com/sites/PublicTest


$oldsite = Connect-PnPOnline -Url $oldsiteurl -Credentials Compliance -ReturnConnection
$newsite = Connect-PnPOnline -Url $newsiteurl -Credentials Compliance –ReturnConnection


$oldnavlinks = Get-PnPNavigationNode -Location QuickLaunch -Connection $oldsite

[array]::Reverse($oldnavlinks) # <-- The magic goes here

foreach ($link in $oldnavlinks) {
Add-PnPNavigationNode -Location QuickLaunch -Title $link.Title -Url $link.Url -First -Connection $newsite -External
}

There’s a lot of foundation there, but you can see where the Array reversal fits in. Here’s how it looked when I ran it:

image

And here’s what it looked like after I ran it:

image

There’s a lot more tweaking I can do, like make sure “Home” is still on top, stuff like that, but finding Reverse was an important step in the beginning.

tk

ShortURL: https://www.toddklindt.com/PoshReverseArray

October 28
Podcast 443 - Read the History Books

Many important topics are discussed in this week's episode. Shane is excited about the new Meet Now button in Teams and his new PowerApps for SharePoint class. Todd is equally excited about the new version of SnagIt that is out. That and more.

Recorded 10/23/2019

Audio File

Video File

Podcast 443 - Read the History Books (Time 0_18_03;06)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 40:14

Links:

PowerApps for SharePoint People
SnagIt 2020 is here
Office 365 User Offboarding Done Right

ShortURL: https://www.toddklindt.com/Podcast443

October 25
Podcast 442 - Masking Tape on a Stick

Todd and Shane are back after a "break" filled with work. They kick off the technical talk with the announcement of the SharePoint Migration Tool updates. Then they mention some cool fun things with PowerPoint presenter, classes they're working on, and articles that they wrote. Then they talk about some fun updates to the Tesla and how much fun playing with the features can be. They wrap up with a little more technology talk about the Surface event and the new releases announced.

Recorded 10/02/2019

Audio File

Video File

Podcast 442 - Masking Tape on a Stick (Time 0_18_56;04)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 44:01

Links:

07:57 SharePoint Migration adds public preview of 2010
39:29 Surface Laptop 3
39:30 Surface Pro
15:24 Everything you need to know about Office 365 September 2019
16:04 PowerPoint Presenter Coach

ShortURL: https://www.toddklindt.com/Podcast442

October 23
Podcast 441 - That's Great Feedback!

Todd airs some grievances, Shane talks about his new iPhone and the maze that is PowerApps licensing. All in this week's podcast.

Recorded 9/25/2019

Audio File

Video File

Podcast 441 - That's Great Feedback! (Time 0_35_15;16)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 39:09

ShortURL: https://www.toddklindt.com/Podcast441

October 23
Podcast 440 - Special Dance that We Do

Quick catch up today with Todd and Shane as they have a lot of pressing engagements. They chat a bit about security cameras and some cord cutting updates and the jump in to a lot of SharePoint news on web parts, modern sites, site swaps and some page publishing enhancements. A lot of content in a short time.

Recorded 9/4/2019

Audio File

Video File

Podcast 440 - Special Dance that We Do (Time 0_06_50;04)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 23:04

Links:

03:14 Blink XT2 cameras
15:46 New SharePoint Web Parts
18:34 SharePoint Page Publishing got some enhancements
19:03 Using Invoke-SPOSiteSwap to Swap in a New Root Site in Office 365
19:10 Using Invoke-SPOSiteSwap to Swap in a New Root Site in Office 365 – Follow Up

ShortURL: https://www.toddklindt.com/Podcast440

October 21
Podcast 439 - Handsome Faces and Witty Repertoire

Todd gives valuable Caribbean vacation advise and demystifies supper for Shane in this week's podcast. After that they cover using VS Code with PowerShell and Azure DevOps, password managers, Ring Cameras, PowerApps, and Shane's disappearing IP address.

Recorded 8/21/2019

Audio File

Video File

Podcast 439 - Handsome Faces and Witty Repertoire (Time 0_21_57;16)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 47:33

Links:

42:27 PowerApps Hide Button based on User
43:05 PowerApps Email Attachments

ShortURL: https://www.toddklindt.com/Podcast439

October 18
Podcast 438 - No Argument. Shut Up. Boom!

Todd and Shane are both around this week to talk about some fun technology. They start with a nice SysKit care package and compare notes on how to make sure that they get everything level this time. Then they start with the news about Skype for Business retiring and how Teams has impacted collaboration. They do talk a bit about SharePoint and Office 365 including some PowerApps and Flow licensing changes. They also talk about some PowerShell and dates and how confusing that can be. Wrapping up with talking about the upcoming conferences that they will be attending.

Recorded 7/31/2019

Audio File

Video File

Podcast 438 - No Argument. Shut Up. Boom! (Time 0_27_49;15)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 46:00

Links:

04:02 Skype for Business Online to Be Retired in 2021
09:37 13 Million Daily User in Teams
17:38 How many document libraries shall I have in a SharePoint Site?
22:11 10 things you should do with your office365 demo or dev tenant
25:46 Wrangling Dates and Times with PowerShell
26:00 Video PowerShell Date and Time
33:31 PowerApps and Flow Licensing Update
41:01 Why does it take 4-6 weeks to unsubscribe
SharePoint Roadmap
PowerApps Hide Button based on User

ShortURL: https://www.toddklindt.com/Podcast438

October 18
Podcast 437 - Not Restricted by Reality

Todd and Shane are finally around to do a podcast since they've both been traveling. This week they talk a lot about Azure Functions and how to wrangle long lists in SharePoint. They then talk a bit about certificates before wrapping up talking about Tesla adventures.

Recorded 7/24/2019

Audio File

Video File

Podcast 437 - Not Restricted by Reality (Time 0_12_26;27)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 43:23

ShortURL: https://www.toddklindt.com/Podcast437

October 17
Podcast 436 - Just being Jerks

Todd and Shane are back after a brief hiatus that wouldn't even be noticed because of the delays in production. They were both renewed as MVPs, but also talk about some PowerShell, Teams, OneDrive, and Power Platform topics. Wrapping up with a little discussion of all of the fun conferences they're going to in the coming months.

Recorded 7/3/2019

Audio File

Video File

Podcast 436 - Just being Jerks (Time 0_28_03;20)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 48:01

Links:

  1. 08:40 How to Store Windows Credentials with the PnP PowerShell
  2. 11:02 Office 365 PowerShell Module Installs
  3. 40:39 Cloudflare took down part of the internet
  4. 20:46 Teams Client is getting bundled in
  5. 28:00 OneDrive Personal gets new security and more storage
  6. 38:33 PowerApps Business Card Scanner
  7. 39:00 PowerApps Object Detector

ShortURL: https://www.toddklindt.com/Podcast436

October 16
Podcast 435 - Be the Idiot

Todd and Shane spend a little time this week joking about the logos that could be on Todd's wall, then move into a review of the Microsoft Business Applications Summit. Shane tells us all of the great announcements that came out of the event. They also talk a little bit about SharePoint and Yammer updates as they wrap up the podcast.

Audio File

Video File

Podcast 435 - Be the Idiot (Time 0_33_28;09)

YouTube (Subscribe)

Subscribe in iTunes

04:42 Top 10 Office 365 Best Practices Every Admin Should Know
12:00 Pat the SharePoint Cow
14:09 MBAS Resources
23:20 PowerApps AI is awesome
32.53 PowerApps Portal
42:30 All MBAS Sessions on Demand
43:00 SharePoint hubs limit raised to 2,000
44:58 New Yammer files in Office 365-connected groups will be stored in SharePoint
45:00 How do I tell where my Yammer files are being stored?
51:00 https://www.cartalk.com/radio/letter/texting-abbreviations-elderly

Running Time: 52:17

Links:

ShortURL: https://www.toddklindt.com/Podcast435

1 - 10Next
 

 Subscribe to my Netcast

 

You can watch Shane and I's Cloudy Podcast live every Wednesday Morning at 10:00 am Central US time at http://www.toddklindt.com/Netcast

You can subscribe to the Podcast in the following ways:

MP3 Audio

Windows WMV video

YouTube Channel

 

 SPDocKit

 
 

 Todd's Upcoming Events

 
  
  
There are no items to show in this view of the "Events" list.