9
votes
Export/import content type to another site collection pnp powershell
Connect-PnPOnline https://yoursite.com/sites/yourFIRSTsite
Get-PnPProvisioningTemplate -Out "MyTemplate.xml" -Handlers Lists,ContentTypes
Disconnect-PnPOnline
Connect-PnPOnline https://yoursite.com/...
- 5,876
8
votes
Accepted
Retrieve Permissions at folder and file level in Powershell
This is the method using PnP Online.
Retrieve the additional properties using
Get-PnPProperty
Connect-PnPOnline -Url $siteUrl
$context = Get-PnPContext
For Files
$file = Get-PnPFile -Url $...
- 191
7
votes
Accepted
PnP Poweshell: Get-PnPListItem Restrict to a Specific View
Unfortunately, There is no direct parameter like -View to specify your View Name in Get-PnPListItem
Meanwhile, as a workaround solution, you can pass the CAML Query to the -Query parameter based on ...
- 45.3k
7
votes
Accepted
How to disable "Connect to Teams" banner in SharePoint Online
You need to use /_api/groupsitemanager/HideTeamifyPrompt method to disable the Teamify banner.
You can use it in PnP PowerShell as below:
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/...
- 30.6k
6
votes
Pnp powershell boolean field
After you create your field using Add-PnPField, you need to get that field using Get-PnPField and set the default value as below:
$field = Get-PnPField -List CustomList -Identity "BoolField"
$field....
- 30.6k
6
votes
catch statement does not work SharePoint Online PNP
I had the same issue of not being able to catch exceptions with Add-PnPListItem. Running it in a variable and adding -ErrorAction Stop worked for me.
Using parts of the OP's script for this example, ...
- 63
6
votes
Accepted
How i can verify that our migrated "Contribute" permission level is exactly the same as the source Contribute permission
I can show how to get this using JavaScript and REST:
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/RoleDefinitions/getByName('Contribute')",
async: false,
headers: {
...
- 1,505
5
votes
PowerShell Script to Find SharePoint List Template ID
For starters, you compare on the wrong property (and you are not using a PowerShell compare operator):
Change
if($mylistsToIgnore==$eachList.TempladID)
to
if($mylistsToIgnore -eq $eachList....
- 24.7k
5
votes
Connecting to SP2016 using PnP
I have the same issue. A workaround is to use the parameter -UseWebLogin.
Connect-PnPOnline -Url https://collab.myCorp.com -UseWebLogin
- 4,385
5
votes
Accepted
Batch update via PNP Powershell
By default CSOM is batch update request so all the request are queued until execute query method is called.
Use Powershell SPO online commands to create new item but do not call execute query until ...
- 5,935
4
votes
Sharepoint Online: Powershell recursive CAML query possible?
Try <View Scope='Recursive'>
ViewScope enumeration
Example,
Get Items Under Folder CAML
- 5,379
4
votes
SharePoint/PnP PowerShell with PowerShell Core 6.0
Unfortunately, the answer is no at the moment.
PowerShell Core 6.0 is built on top of .NET Core 2.0 runtime. But the thing is, PnP PowerShell depends on PnP CSOM Core components which are dependent ...
- 30.6k
4
votes
Accepted
Add site collection level application catalog
1) You need SharePoint tenant admin access to enable Site collection app catalog. It is assumed that the we already have a tenant app catalog. If its not present, you need to create that first and ...
- 30.6k
4
votes
Accepted
Site provisioning: add web part to page
You can use the {{listid:ListName}} token instead of hard-coding the GUID.
When you use this token , the provisioning engine will fix the placeholder with the actual value of the List ID.
For ...
- 30.6k
4
votes
Accepted
How to determine what columns the sharepoint visitors group has
For most PowerShell cmdlets, try something like this:
get-pnpgroupmembers -identity "visitors group" | select *
or
get-pnpgroupmembers -identity "visitors group" | Get-Member
As the PNP cmdlets ...
- 6,767
4
votes
Accepted
Can i using PnP script Update our custom list items "Status" field without affecting the ModifiedBy and Modifed fields
Yes, you can use Get-PnPListItem with CAML query to fetch the based on your conditions and then update them using Set-PnPListItem and passing the SystemUpdate parameter which wont change the modified ...
- 30.6k
4
votes
New-PnPSite - Check if site is allready created?
You can use the Get-PnPTenantSite command to check if a site collection exists or not as below:
$site = ""
Try
{
Write-Host "Checking, if site already exists..."
$site = Get-PnPTenantSite -...
- 30.6k
4
votes
Accepted
Use App Password to Authenticate with PowerShell PnP
Yes.
You can use app password to authenticate SharePoint Online site using PowerShell PnP.
Hit below URL:
Connect-PnPOnline -Url https://contoso.sharepoint.com
It will open a pop-up like below ...
- 36.2k
4
votes
Download specific files from a folder in Sharepoint by using Powershell
You could use a CAML query to select your files. This example will get the last 5 modified files. Note that RowLimit won't work as expected, hence the select -first 5 at the end
$listname = "...
- 2,239
4
votes
Accepted
get-pnpweb example with connection parameter
Connection needs to be returned from PnP command when you connect to a site/web
you can implement this as below.
#Web 1 already connected
Connect-PnPOnline -Url "https://mytenant.sharepoint.com/...
- 2,865
4
votes
Accepted
Bulk Upload 1M files with SharePoint PnP PowerShell
Try this:
create a sample document; for instance demodoc.pdf in a folder called DemoFolder
use the below PowerShell script to multiply the document demodoc.pdf into one million copies, each with ...
- 172
3
votes
PowerShell Script to Find SharePoint List Template ID
There is no TemplateId property in SPList object. You have to find it by TemplateFeatureId in SPWeb.ListTemplates.
$myListColl = $eachWeb.Lists
$mylistsToIgnore = @(101)
foreach ($eachList in $...
- 1,661
3
votes
Sharepoint Online: Powershell recursive CAML query possible?
Get-PnPListItem -List $targetList -Query "<View Scope=`"RecursiveAll`"><Query><Where><Eq><FieldRef
Name = 'FileLeafRef'/><Value Type =
'Text'>Test.txt</Value&...
- 32.4k
3
votes
Accepted
Unable to remove Office 365 Group Site Collection
The solution for the 403 error was to unlock the site collection.
Set-SPOSite -Identity <URL> -LockState unlock
After that the site collection could be removed with
Remove-SPOSite
- 541
3
votes
Accepted
Using PnP Powershell, retreive a document's path
You need to use $libitem["FileRef"].
So, modify your inner foreach loop as below:
foreach($libitem in $libitems)
{
if({$_.Name -match ".doc*"})
{
write-host "lib path... " $libitem["...
- 30.6k
3
votes
Accepted
I need a PowerShell script to Enumerate Sites, Sub-sites,Lists and document libraries and print them in a .csv file (SP 2007)
Here is a tool which we used for SharePoint 2007.
http://spm.codeplex.com/releases/view/22762
- 713
3
votes
Convert the SOM to PowerShell
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue;
$spSite=Get-SPSite -Identity "http://sp/sites/dev"
$spwWeb=$spSite.OpenWeb()
$spAuditQuery=New-Object ...
- 1,737
3
votes
Retrieve Permissions at folder and file level in Powershell
In case you just want to use pnp-powershell, All you need to do for each one of those folders / files:
FILE
$result = Get-PnPProperty -ClientObject $file -Property RoleAssignments
Get-...
- 793
3
votes
Accepted
understanding set-pnplistitempermission
By list item object, it means passing the Microsoft.SharePoint.Client.ListItem object.
You are currently passing string which will not work.
You need to use Get-PnPListItem to get the list item and ...
- 30.6k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pnp-powershell × 726sharepoint-online × 542
powershell × 278
pnp × 83
sharepoint-server × 47
csom × 33
modern-experience × 33
list × 29
development × 27
document-library × 27
office-365 × 25
pnp-provision × 24
sharepoint-enterprise × 23
powershell-script × 17
permissions × 15
administration × 15
content-type × 13
2013 × 12
error × 11
site-template × 11
modern-pages × 10
office-dev-pnp × 10
navigation × 9
microsoft-teams × 9
office-365-groups × 9