Today, we’ll look at creating SharePoint List in office 365 using PowerShell PnP.
First we need to connect the SharePoint Online site using the below command,
Step 1
Open SharePoint Management Shell as an Administrator in your machine.
Step 2
Run the following command to import PnP to install the PowerShell cmdlets:
- Install-Module SharePointPnPPowerShellOnline
Step 3
To use the library you first need to connect to your tenant using the below cmdlets.
- connect-PnPOnline –Url https:
Create a List/ document library
Now that we’re logged into the site collection, let’s create our List/document library.
Syntax
This syntax is referred from
msdn- New-PnPList
- -Title <String>
- -Template <ListTemplateType>
- [-Url <String>]
- [-Hidden [<SwitchParameter>]]
- [-EnableVersioning [<SwitchParameter>]]
- [-EnableContentTypes [<SwitchParameter>]]
- [-OnQuickLaunch [<SwitchParameter>]]
- [-Web <WebPipeBind>]
- [-Connection <PnPConnection>]
Create List
- New-PnPList -Title Demo Lisy -Template GenericList
- Write-Host "TEST list successfully created" -ForegroundColor Green
Create Libraray
Run the following command to create a document library,
- New-PnPList -Title "Demo Library" -Template DocumentLibrary -OnQuickLaunch
Thanks for reading my blog.