Quickly Clear Followed Sites Using Pnp Powershell

By Monday, May 28, 2018 on May 28, 2018 Tags:
Quickly Clear Followed Sites Using Pnp Powershell.

In my dev tenant I produce a lot of testing amongst Groups too sites, too this has the lawsuit that my present user is next a lot of, oft amongst the same advert every bit seen inwards the icon below.

In my dev tenant I produce a lot of testing amongst Groups too sites Quickly clear Followed sites using PnP PowerShell

The followed sites are genuinely stored inwards a listing named Social inwards your OneDrive. This listing was introduced amongst SharePoint 2013, too nonetheless last too kicking. You tin forcefulness out access followed sites from the next URL:

https://<tenant>-my.sharepoint.com/personal/<user site>/Social/Sites.aspx

This listing too tracks followed documents too people, only that’s non the focus of this post.

First connect to your OneDrive using PnP PowerShell, hence execute the code below to take all followed sites, too last certain to laid upwardly the right URL inwards the outset line.

$followedSitesUrl = "/personal/<user site>/Social/Private/FollowedSites" $sites = Get-PnPListItem -List Social -Query "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FileDirRef'/><Value  Type='Text'>$followedSitesUrl</Value></Eq></Where></Query></View>" $sites |% { Remove-PnPListItem -List Social -Identity $_.ID -Force } 

Once complete, the listing is immediately empty.

In my dev tenant I produce a lot of testing amongst Groups too sites Quickly clear Followed sites using PnP PowerShell

Thanks for reading : Quickly Clear Followed Sites Using Pnp Powershell


Related Post