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/...
theChrisKent's user avatar
  • 6,001
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 $...
Randeep Singh's user avatar
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 ...
Mohamed El-Qassas MVP's user avatar
7 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: { ...
Joe McShea's user avatar
  • 1,515
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/...
Gautam Sheth's user avatar
  • 30.9k
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....
Gautam Sheth's user avatar
  • 30.9k
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, ...
sonyab's user avatar
  • 63
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....
Robert Lindgren's user avatar
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
Ola's user avatar
  • 4,405
5 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 ...
Gautam Sheth's user avatar
  • 30.9k
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 ...
Siddharth Vaghasia's user avatar
4 votes

Sharepoint Online: Powershell recursive CAML query possible?

Try <View Scope='Recursive'> ViewScope enumeration Example, Get Items Under Folder CAML
Tiago Duarte's user avatar
  • 5,466
4 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["...
Gautam Sheth's user avatar
  • 30.9k
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 ...
Gautam Sheth's user avatar
  • 30.9k
4 votes
Accepted

Add QuickLinks with powershell-pnp

The trick lies in getting the webpart JSON from a workbench page. Go to the workbench page, https://tenant.sharepoint.com/sites/test/_layouts/15/workbench.aspx. On this page, configure your quick ...
Gautam Sheth's user avatar
  • 30.9k
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 ...
Gautam Sheth's user avatar
  • 30.9k
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 ...
Mike Smith - MCT's user avatar
4 votes

Configure LookUp field using Sharepoint PNP Powershell

Example, we can configure the lookup list and show field for lookup field using the PowerShell below. Connect-PnPOnline –Url https://tenant.sharepoint.com/sites/lz –Credentials (Get-Credential) $...
LZ_MSFT's user avatar
  • 6,219
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 ...
Gautam Sheth's user avatar
  • 30.9k
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 -...
Gautam Sheth's user avatar
  • 30.9k
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 where ...
Ganesh Sanap - MVP's user avatar
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 = "...
Rune Sperre's user avatar
  • 2,249
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/...
Akshay Randive's user avatar
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 ...
Donspeck's user avatar
  • 192
4 votes
Accepted

How to delete rows from a SharePoint list using PnP PowerShell?

I think this is what you are asking for: Remove-PnPListItem -List "[Your list Title goes here]" -Identity ($TheItemId)
dinos.kon's user avatar
  • 189
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 $...
Lukas Nespor's user avatar
  • 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&...
Per Jakobsen's user avatar
  • 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
colonel_claypoo's user avatar
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
Ram's user avatar
  • 723

Only top scored, non community-wiki answers of a minimum length are eligible