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
1 vote
1 answer
32 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,492
0 votes
1 answer
24 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
15 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
27 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,638
0 votes
0 answers
15 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
50 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
1 answer
158 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
24 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
28 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
57 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
14 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
55 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
167 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
50 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
0 votes
1 answer
58 views

How to access a List View's custom formatter?

While doing some custom formatting for a List View, invalid JSON was checked-in and now, the List View will not render and I can't find a way to access the custom formatter without rendering the list ...
ChiefTwoPencils's user avatar
0 votes
0 answers
65 views

Trying to write a PnP powershell script to update all highlighted content webparts sort from author to title

I have a sample script that I am trying to use to test out updating a highlight content web part sort from Author to title but any time I run it, it produces a bunch of Unicode characters like (\u003e\...
Luke's user avatar
  • 13
1 vote
2 answers
112 views

Add-SPOTheme : The term 'Add-SPOTheme' is not recognized as the name of a cmdlet, function, script file, or operable program

I am trying to apply a custom theme color to my SharePoint online site from an article I got online. Im running it in SharePoint online Management shell. I have the latest version of SPO management ...
Hes JvR's user avatar
  • 89
0 votes
1 answer
108 views

.Replace() will return empty string inside my Powershell script

I have the following PnP PowerShell to get the URL of a file and remove the ".lock" string from the file name using Replace:- $url = $item.File.ServerRelativeUrl Write-Host "$(Get-Date) ...
John John's user avatar
0 votes
1 answer
31 views

Unable to get the file which have '.lock' extension inside PnP PowerShell script

I have this PnP PowerSell script to get all files which have .lock extension:- $AllItems = Get-PnPListItem -List $Library -PageSize $BatchSize -Fields ID -ScriptBlock { Param($items) $global:counter +=...
John John's user avatar
0 votes
0 answers
18 views

PnP Script which work on file modified on 10 March 2023 >> restore previous version >> rename the restored file

We have someone who have modified many files on 10 March by adding .lock extension to the files so Test.xlsx become Test.xlsx.lock. so can i write a power shell script which do the following:- ...
John John's user avatar
0 votes
1 answer
33 views

How can I programatically create a new view for Promoted Links using PnP Powershell?

I've got a Promoted Links list in SharePoint 2016 on premise with an additional custom field 'Category' (type: Text) added to it. I want to make additional view that filter the Tiles based on this ...
Robert Wagenaar's user avatar
1 vote
2 answers
56 views

Set index on a column in a large list programmatically

I can manually set an index on a column in a large SharePoint list (10000+ items) but I'm not able to do it programmatically. With (PnP) PowerShell I've tried: # get context $Context = Get-PnPContext ...
Betelgeuse's user avatar
0 votes
0 answers
88 views

Getting errors: "Version conflict" or "The file XXX has been modified by YYY on ZZZ date and time"

SharePoint Problem: For a library created with Versioning Settings set to No Versions For folders created with $Versions = Get-PnPFileVersion -Url $folderPath $...
Hasan Muhammad's user avatar
0 votes
0 answers
87 views

Unable to set the Default Values for our folder using PnP Core SDK

I have a managed metadata field named Customer as follow:- and using PnP Core SDK inside Azure Function >> i am trying to set a default value for it inside the folder:- here is the code, where ...
John John's user avatar
0 votes
0 answers
24 views

Import non existing CSV rows to SharePoint online list

I'm very new to Powershell and try to import CSV rows into a SharePoint online list. I found several things on the net and combined them all together so what i'm trying to achieve almost works. ...
Kaddrik's user avatar
  • 23
0 votes
0 answers
40 views

Bulk add owner to all Teams using PnP PowerShell?

I need some help in adding my admin account as one of the owners of all my Teams group using the Powershell https://pnp.github.io/powershell/cmdlets/Add-PnPMicrosoft365GroupOwner.html Because without ...
Senior Systems Engineer's user avatar
0 votes
1 answer
29 views

Get-PNPFile can't see files created by users when logged in with app/thumb

If I connect to sharepoint via interactive login and add a file I can see it on the sharepoint web site. Connect-PnPOnline -Url $Surl -Interactive Add-PnPFile -Path c:\temp\check1.log -Folder "...
Gummby8's user avatar
0 votes
1 answer
122 views

Should we pass the Library Title or Library Name inside this PnP Function " Get-PnPListItem -List"

Should we pass the Library/List Title or Library/List Name inside this PnP Function? Get-PnPListItem -List" Now based on my test both will work, so could the PnP fail safe to get the library ...
John John's user avatar
0 votes
2 answers
77 views

Parameter 'Web' is obsolete. The -Web parameter will be removed in a future release. Use Connect-PnPOnline -Url [subweburl] instead to connect

I have this PnP Power-shell to loop through all sites >> then all libraries >> then list all the main folders inside the libraries. $AdminUrl = "https://****-admin.sharepoint.com/&...
John John's user avatar
0 votes
0 answers
99 views

Why i can not add "-PageSize" to "Get-PnPFolderItem" so we can get all the folders even if we have more than 5000 folders?

I have this PnP Power-shell to loop through all sites >> then all loop through libraries >> then list all the main folders inside the libraries. $AdminUrl = "https://****-admin....
John John's user avatar
0 votes
1 answer
135 views

Export our PnP variables and outcomes to CSV file

I have this script to loop through all site collections >> and all document libraries >> then list the folders in this format "Site Name >> List Name >> Folder Name":...
John John's user avatar
0 votes
1 answer
425 views

How I can ONLY get the first level folders (main folders) inside document library, seems "Get-PnPFolder -List $Library" retrieve all the sub-folders

I have this script to loop through all site collections >> and all document libraries >> then list the folders in this format "Site Name >> List Name >> Folder Name":...
John John's user avatar
0 votes
1 answer
35 views

Get-PnPField on the web/site level and not on the list level. is this possible

I have this PnP Powershell script to get a field on the list level and hide it from the New form:- Connect-PnPOnline <tenant-site-url> $ctx = Get-PnPContext $field = Get-PnPField -Identity <...
John John's user avatar
0 votes
1 answer
55 views

Looking for a PowerShell Script to "Display this document library on the Quick Launch?"

We are doing bulk network share drive migrations into SharePoint. The SPO Migration tool automatically creates the document library, but does not automatically add it to the Quick Launch. There does ...
Scott's user avatar
  • 25
0 votes
1 answer
390 views

Power Shell script to Send email using Office 365 SMTP with attachment

I have this code to send email with attachment:- $encpassword = convertto-securestring -String "*****" -AsPlainText -Force $cred = new-object -typename System.Management.Automation....
John John's user avatar
0 votes
1 answer
48 views

Limiting site / list access with PnP.PowerShell

Is there any way that I can limit the account created with Register-PnPAzureADApp to a specific site, and ideally List? The permissions that get created in the AzureAD app are broad - "AllSites....
Tim 's user avatar
  • 103
1 vote
2 answers
289 views

Disabling PowerApps button on SharePoint list

I am attempting to disable the PowerApps button on the hero ribbon without success. I've tried the following: Set-SPOSite –Identity SiteUrl -DisableAppViews Disabled -DisableFlows Disabled and ...
Jeff O's user avatar
  • 21
0 votes
0 answers
55 views

Find/Export all Site Collections a group of users have access to

I am struggling to find a way, using powershell, to find/export all site collection a group of users have access to. What I have is a *.csv file with roughly 30 users listed. I need to loop through ...
stacy mcmillan's user avatar
0 votes
2 answers
230 views

How can I know the Powershell credential request username and password?

I've been trying to run different PowerShell scripts to get all or subsites that are into a site collection, however when I run this ask for the Windows PowerShell credential that haven't able to ...
Priscilla's user avatar
0 votes
1 answer
153 views

How can I pass parameter to (Get-PnPUser | ? Email -eq ($SPUserEmail));

I have the following PnP PowerShell script: $conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=$DBServer;Integrated Security=True;Initial Catalog=$DBName") ...
John John's user avatar
0 votes
0 answers
44 views

Update existing .json file using PnP PowerShell

I have exiting .json file. Please find the exiting file tags. Exiting .json file: { "properties": { "connectionReferences": { "shared_sharepointonline": { ...
Harish Patil's user avatar
0 votes
1 answer
49 views

The term Get-PnPAzureADUser is not recognized as the name of a Cmdlet

I have a PnP Power shell script, but it is raising this error:- The term Get-PnPAzureADUser is not recognized as the name of a Cmdlet any advice? Thanks
John John's user avatar
0 votes
1 answer
35 views

Can we define Bcc using Send-PnPMail

Can we define Bcc using Send-PnPMail cmdlet in PnP PowerShell?
John John's user avatar
0 votes
0 answers
45 views

Retrieve permissions of only first level folders in a SharePoint online Document Library

We have a request from our auditors to provide a csv file, that contains for each document library in a site, unique permissions applied on only the first level of folders within the document library, ...
Berdj Boyadjian's user avatar
0 votes
1 answer
170 views

Populate a People/Group field which allow multiple selection using PnP Power shell for. Error "Add-PnPListItem : The specified user could not be found

I have a SharePoint online field named "HRContacts" which allow multiple selection:- and using PnP Power Shell i want to create a new list item and populate this field among with other ...
John John's user avatar
0 votes
0 answers
26 views

what is the equivalent code for Microsoft.SharePoint.SPFieldUserValueCollection in PnP Power shell

I have the following onpremises power shell:- $HRCollabs = $null [Microsoft.SharePoint.SPFieldUserValueCollection]$HRCollabs = New-Object Microsoft.SharePoint.SPFieldUserValueCollection $HRuserValue = ...
John John's user avatar
0 votes
0 answers
11 views

Convert Get-ADUser to Get-PnPAzureADUser

We have the following Power shell code which connect to onpremsies AD:- $HiringManger = Get-ADUser -Filter {enabled -eq $True -and mail -eq test@***.com } -SearchBase "OU=Sites,dc=company-tech,...
John John's user avatar
0 votes
1 answer
9 views

Can we define NOT IN inside CAML Query

I have this Power Shell script which work on SharePoint 2013 on-premises: $NewHireList = $spSourceWeb.Lists["ONB New Hire"] $NewHireItem = $NewHireList.Items | Where {$_["Candidate ID&...
John John's user avatar
1 vote
1 answer
189 views

Get SharePoint storage used by the sites via powershell

I want to get the total number of storage used by SharePoint sites. I can get the total storage allocated to SharePoint organisation which I can do by using the following: Get-SPOTenant | Select-...
hello007's user avatar
-1 votes
1 answer
153 views

Get-PnPFile which allow to create the folder path if the folder path does not exists

I have this command to get a sharepoint file and save it to local folder;- $file = Get-PnPFile -Url $Attachment.ServerRelativeUrl -FileName $AttachmentFileName -Path $Attachmentpath -AsFile -Force ...
John John's user avatar

1
2 3 4 5
15