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/...
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 ...
7
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, ...
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: {
...
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/...
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....
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
5
votes
Accepted
How do i get the a folder ID based on folder name with pnp powershell?
Updated solution:
We have to load the ListItemsAllFields first.
Use
$folder.Context.Load($folder.ListItemAllFields)
$folder.Context.ExecuteQuery()
Set-PnPListItemPermission -List 'Team Reports' -...
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 ...
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
votes
Accepted
Connect-SPOService: Could not load type 'Microsoft.SharePoint.Client.SharePointOnlineCredentials' from assembly 'Microsoft.SharePoint.Client.Runtime,
For PowerShell 7, you have to use the Windows PowerShell Compatibility feature because the Microsoft.Online.SharePoint.PowerShell module was built with .NET Framework and not .NET Core.
The way this ...
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["...
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 ...
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 ...
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 are ...
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)
$...
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 ...
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 -...
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 ...
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 = "...
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/...
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 ...
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)
3
votes
How to lookup AD users with pnp-powershell in SharePoint Online?
There is no PnP native way to do this but you can do it by dropping down into the CSOM EnsureUser method. Try this:
$web = get-pnpweb
$user = $web.EnsureUser("[email protected]")
$ctx = Get-PnPContext
...
3
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 ...
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 ...
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
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
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-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pnp-powershell × 784sharepoint-online × 586
powershell × 312
pnp × 87
sharepoint-server × 47
modern-experience × 37
development × 34
csom × 34
document-library × 33
list × 30
administration × 29
office-365 × 25
pnp-provision × 24
sharepoint-enterprise × 23
permissions × 17
powershell-script × 15
error × 14
2013 × 13
content-type × 13
modern-pages × 11
site-template × 10
office-dev-pnp × 10
navigation × 9
authentication × 9
office-365-groups × 9