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
19 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
21 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
19 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
28 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
  • 389
1 vote
1 answer
35 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
11 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
47 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
27 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
37 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
41 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
20 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
  • 389
1 vote
1 answer
136 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
39 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
81 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
40 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,512
0 votes
0 answers
48 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
37 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
48 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
27 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
20 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
27 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
628 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
17 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
140 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
188 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,405
0 votes
1 answer
26 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
0 votes
1 answer
463 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 -Recursive -...
microsoftdeveloperdesigner's user avatar
0 votes
0 answers
33 views

Method 'SetValueForUICulture' don't set other language value

I have a problem with SetValueForUICulture method in my PowerShell script, I added field using method Add-PnPField and later according to what I found on the internet I tried use SetValueForUICulture ...
kajaak's user avatar
  • 1
0 votes
0 answers
93 views

Unable to get/write the folder name using FileLeafRef inside my PnP Power shell script

I have this PnP PowerShell script to get the folder name:- PS C:\Users\m> $SiteURL = "https://***.sharepoint.com/sites/FilePortal" PS C:\Users\m> $mainfolderUrl = "/sites/...
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
211 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
49 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
0 answers
13 views

Cannot re-add CT from hub to a list after deleting it via PNP script

I added a CT, published from the CT hub, to a SharePoint site page library. I then used script to first remove the CT from the list. Remove-PnPContentTypeFromList -List "SitePages" -...
Arte's user avatar
  • 167
0 votes
1 answer
216 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 vote
1 answer
86 views

Security Validation error while executing Get-PnPAzureACSPrincipal command

I am executing the below PnP Powershell command to get the App Principals registered in the SPO Site: Connect-PnPOnline -Url "SiteURL" -TenantAdminUrl "TenantAdminSiteURL" -...
George's user avatar
  • 1,512
0 votes
0 answers
31 views

Is there any work around to get Graph API reports anonymized data ("DisplayName,"URL","UserPrincipalName") with privacy setting enabled.?

We are generating custom report for all the onedrive users storage data using Graph API("https://graph.microsoft.com/v1.0/reports/getOneDriveUsageAccountDetail"). We are able to get this ...
devsiva's user avatar
  • 35
0 votes
0 answers
36 views

Can we get Onedrive Users Data using (Azure AD App+PnP Powershell) without having admin center access?

My Use case scenario: We are using Azure AD App ("Application Permission") with PnPPowershell to get all the OnedriveUsers storage data. My client is very limited to provide access andso don'...
devsiva's user avatar
  • 35
1 vote
1 answer
272 views

SPO PowerShell to get App Display name and App Identifier from "Site App Permissions" Page

In SPO, how to get the App Display Name and App Identifier details which are displayed in _layouts/15/appprincipals.aspx?Scope=Web page using PowerShell? Get-PnPApp command displays the app details ...
George's user avatar
  • 1,512
0 votes
1 answer
163 views

How to create SharePoint modern site template

I have to create the SharePoint modern site templates, that I can access from "From your organization templates. I have tried following PowerShell but it seems like pages are not getting applied ...
Akshay Dattatray Nangare's user avatar
1 vote
0 answers
78 views

Granting permissions to library, and sharing everything with PowerShell

Is it possible to achieve the same sharing setting with PowerShell, as you would for sharing a document library? Also without foreaching every single item in a document library. After my understanding ...
Kev's user avatar
  • 11
1 vote
2 answers
143 views

PNP script to get all subsite in a single site collection, please with MFA for SP online

Found plenty of scripts but they are not with MFA. MFA is a standard now, do not understand why people insist of creating scripts not considering that. Can someone help?
susan's user avatar
  • 2,658
0 votes
0 answers
42 views

Is it possible to change the "Indexing Site Content" Setting in Sharepoint Online via powershell?

I've spent hours looking at solutions to this high priority issue, using PNPOnline, Sharepoint Online Management Shell, and CSOM, and whenever I try anything using nocrawl, it tells me the property ...
IDontKnowHowToCode's user avatar
1 vote
1 answer
732 views

Using single Connect-PnPOnline connection for different SharePoint sites

I need to get a list of all files, older then 5 years, from few thousands sharepoint online sites and I am trying to do it with powershell script. The problem I am having is that I have to reconnect ...
user3195616's user avatar
0 votes
2 answers
3k views

Connect-SPOService: Could not load type 'Microsoft.SharePoint.Client.SharePointOnlineCredentials' from assembly 'Microsoft.SharePoint.Client.Runtime,

I am trying to run this command inside Windows PowerShell 7 : Connect-SPOService -Url https://***-admin.sharepoint.com But I got this error: Connect-SPOService: Could not load type 'Microsoft....
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
87 views

Hide a field from New & Edit list forms is not working on the site level, only working on the list level

I have this PnP Power shell to hide 2 fields from the New & Edit forms:- #Config Variables $SiteURL = "https://****sharepoint.com/sites/c1" $ListName = "CustomTest" $FieldName =...
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
151 views

Create a SharePoint Modern Team Site with PNP PowerShell

I tried to create a new Modern SharePoint Site with the PNP Framework. I ran in the following error. I want to store the Url in a variable. Everytime I store it in a variabel I get an error message: ...
Matthias's user avatar
1 vote
2 answers
425 views

How to extract department from page properties using Powershell's PnP and set it?

I have the following page: test.aspx But when I run Get-PnPClientSidePage, I do not see it as a value, even if I expand any of the items listed. Additionally, I don't see a description either. Once ...
Me Myself's user avatar
0 votes
1 answer
74 views

SharePoint 2013 : Get-PnPFile: No digest found!

How to download SharePoint 2013 document library files using the PnP command Get-PnPFile ? Connect-PnPOnline -Url http://sharepoint2013site -TransformationOnPrem -CurrentCredential $items = (Get-...
ameliapond's user avatar
0 votes
1 answer
204 views

How to backup the SharePoint pages in the Site pages library with PnP Powershell

How can I backup my SharePoint pages resided in the Site pages library of my Communication site using PnP PowerShell?
user1903995's user avatar
1 vote
1 answer
1k views

Automate clearing SharePoint Recycle Bin and Second Stage Recycle Bin

Does anyone know of a way to automate clearing recycle bin and second stage recycle bin for SharePoint? I use my SharePoint strictly for scheduled backups of my OS and the items in the recycle bins ...
CntrlAltDel's user avatar
0 votes
0 answers
97 views

Provisioning a Teams Template with a specific folder structure with the PNP provisioning engine in PowerShell

I try to create a template for Teams with a specific folder structure, e.g. General -Folder 1 -Folder11 -Folder12 -Folder 2 I managed to create a Team with PNP so far, but I'm struggeling to connect ...
Matthias's user avatar

1
2 3 4 5
16