Questions tagged [pnp-powershell]
PowerShell commands that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use CSOM and can work against both SharePoint Online as SharePoint On-Premises.
781 questions
0
votes
0
answers
25
views
SP 2016 to SP Online page modernization approach using PnP
Describe the scenario
We are working on a SharePoint 2016 → SharePoint Online migration project and need to modernize publishing pages (including blog pages and web part pages) as part of the ...
0
votes
0
answers
42
views
Transformation of SharePoint 2016 publishing pages to SharePoint Online modern pages via PowerShell since Sep 2024 authentication change
I need to migrate SharePoint 2016 on-premises publishing pages to SharePoint Online, in the process transforming them to Modern pages.
Prior to September 2024 the general approach was like the start ...
0
votes
0
answers
30
views
How can I find names of groups assigned to a specific folder using PnP PowerShell
Morning All,
Using PnP PowerShell how can I find the sharepoint group(s) assigned to a specific folder?
I thought the following code would work but it doesn't:
#Get the WorkSet folder from URL
$...
0
votes
0
answers
21
views
Difference between Set-PnPFolderPermission and Set-PnPListItemPermission
I want to get a better handle of Set-PnPFolderPermission and Set-PnPListItemPermission.
What are experienced PnP PowerShell programmer's take on the differences between Set-PnPFolderPermission and Set-...
0
votes
0
answers
53
views
How to get a permissions matrix re[port of all SharePoint sites and document libraries in the tenant
I'm trying to get the below powershell script to work but getting this error :
The term 'Get-PnPRoleAssignment' is not recognized as a name of a cmdlet
It seems this command does not exist and if not ...
0
votes
1
answer
34
views
Getting values from multi-choice lookup field in Get-PnPListItemVersion response
Using Get-PnPListItemVersion i'm trying to get values from a SharePoint multi-choice lookup column but i'm having difficulty inspecting the field returned by Get-PnPListItemVersion
$versions = Get-...
1
vote
1
answer
370
views
Getting error as "Insufficient Privileges to complete the operation" while running command "Get-PnPMicrosoft365Group"
I am facing error:"Forbidden (403): Insufficient privileges to complete the operation." while executing command
$groupObj = Get-PnPMicrosoft365Group | Where-Object {$_.DisplayName -eq $group}...
0
votes
1
answer
101
views
import export list from two different SharePoint Online sites using PnP Powershell
I'm looking for a way to import a sharepoint list of a sharepoint site and export it into another destination.
I looked at this Powershell PnP commands
I don't want the CopyList as i need to have the ...
0
votes
1
answer
63
views
Set-PnPList or Set-PnPField fails to update immediately after a new list is created using Copy-PnPList
Any ideas why this code is not executing as expected? I tried adding a sleep after the Copy-PnPList but still didn't work.
try {
#Connect to the template site
$templateSiteConnection =...
0
votes
0
answers
37
views
I want to capture File Versions on a Sharepoint Tenant
Here is my script, but I cant capture file versions.
#Config Variables
$TenantAdminURL = "https://admin.sharepoint.com"
$CSVFilePath = "C:\Temp\RESTART.csv"
#Get the Root Web
#$Web ...
0
votes
0
answers
80
views
How do I use PnP to move large amounts of files without breaking sharing links and permissions?
I'm trying to find an archiving solution for my company that's easier than using the GUI and scrolling through large amounts of files and folders and manually using the Move To button. I have written ...
0
votes
0
answers
31
views
Copy user field with inactive user using pnp powershell
I'm following this tutorial to copy some fields into other fields in my list.
Overall it is working great, but when I copy a user field sometimes the pnp powershell throws "WARNING: No values ...
0
votes
1
answer
93
views
Invoke-PnPTenantTemplate did not perform any action
I have 2 tenants; Source & Destination. I export the site from source and try to invoke it inside the destination, but it failed, here are the steps i followed:-
Connect-PnPOnline -Url "...
0
votes
1
answer
500
views
Get-PnPSiteTemplate: The remote server returned an error: (403) Forbidden
I want to copy one site collection from one tenant to another, so on the source tenant, I created this App Registering and I grant it full control on SharePoint:-
And I define to use secret for the ...
0
votes
1
answer
106
views
Set-PnPTaxonomyFieldValue gives 'cannot bind parameter' error
I am using PnP.Powershell version 2.12.0.
I am trying to set values of two new managed metadata columns in a list using values from other columns. But I keep getting the following error:
Cannot bind ...
2
votes
1
answer
288
views
Connect-PnPOnline and long running proces. Token expired
I use Connect-PnpOnline with -interactive because my account uses MFA. I can connect and run my scripts against my site. I have a script that runs very long. During the execution of the script the ...
2
votes
1
answer
413
views
How do I find out what kind of access a user has to a SharePoint Online site using PNP PowerShell?
In Powershell, after running the Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/xyz -UseWebLogin and Get-PnPUser -WithRightsAssigned commands, I can get the list of all users that have ...
0
votes
1
answer
180
views
Set-PnPSiteVersionPolicy for thousands of sites in SharePoint Online - Cannot call this API with an app-only principal
We have 5000+ SharePoint Online sites in our tenant where i have to change the Site Version setting to automatic for all existing document libraries.
I am using the below to connect using an Azure App ...
1
vote
1
answer
457
views
PnP Powershell script to get hyperlinks from a page
Before I begin, I need to tell you that I am an absolute beginner when it comes to Powershell, this is my first attempt at it and I've mostly been trying to use AI to help me get it running.
I am ...
0
votes
0
answers
162
views
Updating webparts on SharePoint Online Site collection home page
I'm using PowerShell to update QuickLinks webpart in a Modern SP environment. Updating a "Page" works just fine using the set-pnppagewebpart cmdlet.
However, when I try to use the same ...
1
vote
0
answers
123
views
remove Everyone and Everyone Except External Users from all places in an SPO Sites
Requirement:
One of our Clients is working on correcting permissions on there tenant and thus needs to remove "Everyone" and "Everyone except external users" from identified places ...
0
votes
1
answer
145
views
How to add a list webpart in a classic page using PowerShell
I have a classic page in SharePoint Online. It's a standard homepage from a teamsite in a classic web and I want to add a list webpart to it.
When the web is created, the Home.aspx has three webparts, ...
1
vote
1
answer
172
views
Convert SharePoint On-Premise Publishing Pages to Modern Page - 'Connect-PnPOnline' not working
I am trying to convert On-Premise (SharePoint 2013) Classic Publishing pages to SharePoint online (Modern) pages. I am trying to follow the example given in below article:
https://pnp.github.io/script-...
0
votes
0
answers
55
views
Sharepoint API permissions in Entra App are not working ie Full control granted with admin consent over the tenant but access denied
I can connect via PnP online using a certificate successfully but to perform any actions I get access denied.
This is despite having full control or read and write (I tried both) permissions via the ...
0
votes
2
answers
2k
views
Can i update a list item without affecting the Modified By and Modified Date
I have a custom list named WorkOrders inside our SharePoint online tenant. now this custom list contain around 10K items. and i want to do some modifications to existing list items, as follow:-
1- I ...
2
votes
2
answers
559
views
New site title is not propagating to group or team name if renamed programmatically
When I programmatically change the title of a group-based site using PowerShell, the site gets the new name, but the associated Microsoft 365 group does not. Furthermore, when you log in to the site, ...
0
votes
2
answers
266
views
How to count all files recursive inside a specific folder programmatically in powershell?
How can I count all files recursive inside a specific folder in a document library by powershell? So he needs to count also the files inside the subfolders recursive.
0
votes
1
answer
262
views
Invoke-PnPTenantTemplate is not performing any action, and ends after 2 seconds
I have 2 SharePoint Online tenants which both have a modern communication sites. now i used this command to get the source site template:-
PS C:\Users\mohan> Connect-PnPOnline -Url "https://...
0
votes
2
answers
530
views
Import custom data from excel to sharepoint List in powershell
I come from sharepoint 2019 and i try to import data from excel to a list
It's working fine for date and text datas
But i don't understand about unique choice, checkbox or People picker fields.
my ...
0
votes
1
answer
283
views
How to add AZ Application Client ID to Sharepoint Site collection Owners group
I am in need of some critical automation for SharePoint Online and even though i'm able to perform all tasks, i'm restricted from using the App ID to "share a link" for a file in a Document ...
0
votes
0
answers
565
views
Error : The remote server returned an error : (404) Not found when using Copy-PnPFolder powershell
I have been using the Copy-PnPFolder to copy files between sharepoint sites.
But just suddenly i started receiding this error
: The remote server returned an error : (404) Not found
This is how i ...
0
votes
1
answer
494
views
Can I use the Copy-PnPFolder to copy local files to SharePoint?
I'm trying to use the command below to copy local files to SharePoint.
Copy-PnPFolder -LocalPath "C:\Projects\BS\Banner.zip" -TargetUrl "https://Demo.sharepoint.com/sites/Demo/Documents&...
0
votes
1
answer
3k
views
PnP Powershell Connection with ClientId and ClientSecre return error "The app principal does not exist"
I'm trying to run my Powershell PnP script using ClientId and ClientSecret instead of UseWebLogin.
I already created an Azure Application ID using this tutorial (but skipping the certificate part for ...
0
votes
1
answer
64
views
Cannot compare "PnP.PowerShell.Commands.Model.SharePoint.RecycleResult" because it is not IComparable
I'm downloading files from a SharePoint site to a local folder. I can connect and download files with no issue, but I go to remove them, I'm getting Error: Cannot compare "PnP.PowerShell.Commands....
0
votes
2
answers
279
views
Azure/PowerFlow App (Get-PnPFlowRun/Microsoft.ProcessSimple) XrmApplyUserFailed Failed to create a representing user
Current system runs over user + plain password authentication.
2MFA is coming so I want replace it by client/secret solution.
I have did an app in Azure and things like read/write SharePoint is ...
0
votes
2
answers
906
views
Script to empty 1st & 2nd stage recycling bins from all sites in SharePoint
I'm looking for a way to automate emptying the recycling bins (1st & 2nd stage) from all sites in our SharePoint (Online) collection.
From searching, I've found solutions that no longer work (...
1
vote
1
answer
180
views
Copy-PnPFile to copy Folder contents only not the top-level folder i
I'm using the cooy-pnpfile command to copy content from a specific folder in a doc lib to another doc lib
I don't want it to create a top folder in destination but just copy the folders and files.
Is ...
0
votes
1
answer
170
views
Taxonomy column values not shown in Power Apps Form and Power Automate
i created a taxonomy column to replace an old choice column. I wrote a PowerShell script, which maps the value to the term and updates the item using the PnP PowerShell Cmdlets. The value is there in ...
1
vote
1
answer
559
views
Restrict PnPSearchQuery to just site and subsites not all tenant sites
I had a request from some co-workers to build them a PowerShell to search sites for instances of text that is not accessible so they can replace it. Specifically NA or N/A.
I have a PowerShell working ...
0
votes
0
answers
334
views
PnP PowerShell - Update list fields from CSV file
I have the following code and it has been working. Now our company merged and my computer is with the new company domain. New company don't have access to our SharePoint and it seems like it also want ...
0
votes
1
answer
341
views
Programmatically get shareable link to updated folder (PowerShell)
My goal is to upload approximately 10,000 folders to a SharePoint library (call it T2) and create a list in SharePoint (say T1) that lists these folders along with other details and their ...
1
vote
2
answers
2k
views
How can I use PnP Powershell to enable custom script in a subsite?
My problem is enabling custom script with DenyAddAndCustomizePages.
A two-line script can describe my problem.
Background: I was using Set-SPOSite to enable it like this:
Set-SPOSite $SiteURL -...
0
votes
1
answer
62
views
SharePoint online default templates
I created 50 pages using the SharePoint online template called Blank. This has a header / title webpart at the top which we do not want.
Does anyone know of a way to remove this webpart from all the ...
0
votes
0
answers
159
views
Get-PnPListItem exceeds the lookup column threshold
We are having some issues querying some lists and libraries and I'm afraid we have stared ourselves blind on the matter.
We run the following cmdlet and it throws an error:
$listItems = Get-...
1
vote
1
answer
109
views
How to recognise the differance between a "News Post" and a "Page" programmatically with PowerShell?
I have an intranet and try to get the statistics of News Posts. I have now this PowerShell script below where I do a search query and get some metadata.
Is there some attribute where I can recognize ...
1
vote
0
answers
190
views
Getting error while trying to move documentset from one library to other using PnP powershell
I have a requirement to move the document set(documents inside) from one library to other within the same site, maintaining all metadata and versions in destination library as well.
I tried below ...
1
vote
1
answer
891
views
Issue Creating Org Assets Library (CDN)
I'm attempting to create an organizational assets library for use with company branded templates and copilot features.
I have successfully run this code on my development tenant, but when attempting ...
0
votes
2
answers
2k
views
How to get the total number of nested files and folders inside the main folders inside a document library
We have a SharePoint online document library which contain 40 folders on the root. now i want to count how many nested sub-folders and files each of the 40 folders contain? now in SharePoint the built-...
1
vote
1
answer
224
views
Add-PnPView group by secondary field
I have created a script to create number of views in SharePoint, but I am unable to work out the CAML to group by more than one field if it's possible.
1 field being:
<GroupBy Collapse="TRUE&...
0
votes
1
answer
219
views
Get-PnPProperty -ClientObject with "invalid ID"
After I successfully call $f=Get-PnpFile -Url $Url if I invoke Get-PnPProperty -ClientObject $f -Property Versions I get an error that the object ID is invalid.
Any clue?