Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
12 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://...
microsoftdeveloperdesigner's user avatar
0 votes
0 answers
6 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 ...
Poule's user avatar
  • 3
0 votes
0 answers
13 views

How can I create a site template which includes a document library with a folder structure

I would like to create a site template which includes a document library with a folder structure. I have tried using Get-SPOSiteScriptFromWeb but it only creates the document library not the folder ...
naijacoder's user avatar
  • 4,304
0 votes
1 answer
16 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 ...
powershellFan83's user avatar
0 votes
0 answers
41 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 ...
naijacoder's user avatar
  • 4,304
0 votes
1 answer
38 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&...
naijacoder's user avatar
  • 4,304
0 votes
0 answers
23 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 ...
Dylan666's user avatar
0 votes
1 answer
12 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....
rsford31's user avatar
0 votes
2 answers
46 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 ...
user112964's user avatar
0 votes
0 answers
13 views

Can't edit single web part page

I need to show an embedded Power BI report in full width. Therefore I change a page under Communication Site by using PnP: Set-PnPClientSidePage -Identity $PageName -LayoutType "...
Mark L's user avatar
  • 4,065
0 votes
0 answers
11 views

How do I change a SharePoint Online Highlighted Content Webpart Property from "this site" to "all site" using PnP Powershell?

Background: I'm working with SharePoint Online and using PnP PowerShell to manage webparts on a modern SharePoint page. I want to add a "Highlighted Content" webpart to a page and then ...
Daniel Carlsson's user avatar
0 votes
2 answers
27 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 (...
FotS's user avatar
  • 1
0 votes
0 answers
28 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 ...
naijacoder's user avatar
  • 4,304
0 votes
0 answers
20 views

PnP PowerShell MFA Issue - Set Access Request Email

I'm trying to set Access Request email as Site Owner for all site collections in our M365 tenant using PnP PowerShell command: Set-PnPRequestAccessEmails -Disabled:$false However I see that using ...
Manoj's user avatar
  • 1
0 votes
1 answer
22 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 ...
Johannes's user avatar
0 votes
0 answers
22 views

Using Powershell to copy content type columns from one site to root site collection in Sharepoint Online

I have created a powershell script that takes a sourceSiteURL and sourceContentTypeId and then copies all of the columns from the sourceContentTypeId into the provided destinationContentTypeID located ...
Scott B's user avatar
0 votes
1 answer
77 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 ...
OMGDrAcula's user avatar
0 votes
0 answers
91 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 ...
maria's user avatar
  • 1
0 votes
1 answer
56 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 ...
user1375452's user avatar
1 vote
2 answers
318 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 -...
IshRashad's user avatar
0 votes
1 answer
30 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 ...
Scots_nerd's user avatar
0 votes
0 answers
70 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-...
Anders Nielsen's user avatar
1 vote
1 answer
34 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 ...
KEM's user avatar
  • 13
1 vote
0 answers
81 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 ...
Swetha's user avatar
  • 399
1 vote
1 answer
166 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 ...
Michael Colbs's user avatar
0 votes
0 answers
12 views

powershell add a group to all spo sites but authentication error

I am receiving authentication error. I have pim and access to admin center. any idea? I figured it out. my privilege access expired. it's working now.
debra's user avatar
  • 1
0 votes
2 answers
721 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-...
microsoftdeveloperdesigner's user avatar
1 vote
1 answer
68 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&...
Bob 's user avatar
  • 13
0 votes
1 answer
101 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?
Stéphane BARIZIEN's user avatar
0 votes
1 answer
141 views

How to disable Social media bar for site collection without global admin rights?

A. Context of Access I do not have acces to the central sharepoint admin center but I am the owner of a site collection and I am site collection administrator: I am able to connect to my site ...
Stefan's user avatar
  • 141
0 votes
1 answer
95 views

Unable to install new version Pnp powershell

We have a requirement to extract sharepoint online site template using PnP Powershell. As part of it, I am installing new version of PnP.powershell in Powershell (7.4) CommandPrompt. But there is no ...
Swetha's user avatar
  • 399
1 vote
1 answer
604 views

Break role inheritance for a specific folder

I want to remove all rights to a specific folder in SharePoint document library, all but a group. So, I need to first find the folder and break inheritance on it. How to do it? I use the following ...
serge's user avatar
  • 133
0 votes
0 answers
78 views

Apply Site Policy to Multiple Site Collections with PnP Powershell

Over time, a lot of SPO site collections have accumulated in my tenant. Therefore, I want to use Site Collection Feature called Site Policy to automatically close and delete sites after a defined ...
VeleMilosavljevic's user avatar
0 votes
0 answers
134 views

Add-PnPPageWebPart: Object reference not set to an instance of an object

I'm trying to add Quick Links to my SharePoint site using the PnP Module. However, when trying to run the command: Add-PnPPageWebPart -Page $page -DefaultWebPartType "QuickLinks" -Section 2 -...
Semper's user avatar
  • 1
0 votes
1 answer
85 views

Get-PnPAzureACSPrincipal - is this cmdlet deprecated?

Is Get-PnPAzureACSPrincipal cmdlet deprecated? I was able to use this cmdlet successfully 3 months before, but now ,running this cmdlet displays error that's this is not available. when I run Get-...
George's user avatar
  • 1,522
0 votes
0 answers
81 views

pnp PowerShell script to add all list columns as index

Can I write a PnP PowerShell which get all the list columns and add them as index? skipping the fields which cannot be indexed, such as Multiple line of? or choice which allow multiple selection? ...
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
69 views

Create a duplicate site using "Get-PnPSiteTemplate" will not copy the custom site permissions and the list indexes

I have a SharePoint site named "source" and I want to create a duplicate site for it named "duplicate", so I ran the below commands: Connect-PnPOnline -Url "https://*****....
microsoftdeveloperdesigner's user avatar
0 votes
0 answers
72 views

Add a OneNote template to a document set as default content

using powershell, I'm trying to upload a certain OneNote template to a Document Set with specific contenttypes. I believe the code is working: the document is indeed added to the SharePoint admin GUI, ...
zenlord's user avatar
  • 151
0 votes
0 answers
30 views

How can I bulk delete 1800 folders?

I have a colleague who has written a powershell script to read URLs from a CSV file and create empty folders at those locations... 1800 of them. The problem is they used their own named developer ...
JonS's user avatar
  • 764
0 votes
1 answer
22 views

How can I change the Created By field for 1800 folders?

I have a colleague who has written a powershell script to read URLs from a CSV file and create empty folders at those locations... 1800 of them. The problem is they used their own named developer ...
JonS's user avatar
  • 764
0 votes
0 answers
41 views

Add-PnPPageImageWebPart image resolution/responsiveness #3425

I am fetching news form external websites using an api, i am able to download the images and create news articles in sharepoint. But the image doesnt fit properly as we hardcode height and witdth. The ...
user24778's user avatar
1 vote
2 answers
2k views

Get all shared links to a specific user in tenant

SCENARIO: In my sharepoint online tenant I have a lot of subsites. One external user has access to some resources (list, document library ecc) given via a shared link. I need to delete this user from ...
Alessandro Picardi's user avatar
0 votes
0 answers
26 views

Add SharePoint group to "Group Quick Luanch" using PowerShell

I'm working on a PowerShell script to set up a new site including libraries and groups. I have been able to get the groups set up, however they don't appear in the "Group Quick Launch" so ...
InnerNorth1234's user avatar
0 votes
1 answer
307 views

Can we hide the Sync on all the current sites and future sites using UI or using PowerShell

I know that we can hide the Sync button for a document library or for all the document libraries inside a site as mentioned in this link https://www.sharepointdiary.com/2017/08/disable-sync-button-in-...
microsoftdeveloperdesigner's user avatar
1 vote
1 answer
451 views

How to get the unique viewers count of a document?

I see in SharePoint per document the viewers count. I would like to generate a csv report for all my documents in a specific site/library. I try this PowerShell command, but the the properties "...
Ola's user avatar
  • 4,385
0 votes
1 answer
34 views

Does the Where clause inside PnP Powershell performed on the client or on SharePoint side

I have this PnP PowerShell:- $customerFolders= Get-PnPListItem -List $listName -PageSize 5000 -Fields "Id", "FileLeafRef", "Modified","FileDirRef","...
microsoftdeveloperdesigner's user avatar
1 vote
1 answer
707 views

How i can get all files recursively without folders using Get-PnPFolderItem from the root folder and its subfolders

I want to get all the files from the root folder and its sub-folders, now when I tried this script: $customerFolderFiles = Get-PnPFolderItem ` -FolderSiteRelativeUrl $serverRelativeUrl ` -...
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
348 views

Get-PnPFolderItem can we get the related items in batches?

I have a SharePoint online site which contain a document library named "Customer Share" >> and inside this library we have a folder named "Clients" >> and inside the &...
microsoftdeveloperdesigner's user avatar
0 votes
0 answers
55 views

Error logging SharePoint Online

I am iterating through all the site collection in SharePoint Online, and do something. However, some sites are erring. I am trying to create a log file along with URL and Error message. This logging ...
Pratheep's user avatar
0 votes
1 answer
399 views

Create lookup column with multi select option using Powershell

I want to create lookup column with multi select option using PNP PowerShell in SPO. I am able to create lookup field below script. But i dont know what is the property to be added to make it multi ...
Sriram Tamilarasan's user avatar

1
2 3 4 5
16