Created
November 21, 2021 17:07
-
-
Save expiscornovus/782b7d9c43269f2bffe3518edd9b45de to your computer and use it in GitHub Desktop.
Create list for Course registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# .SYNOPSIS | |
Create list for Course registration. | |
.DESCRIPTION | |
You need to have the latest version of PnP PowerShell | |
Create list for Course registration. | |
.PARAMETER SiteCollection | |
Specifies the site collection Url of the SharePoint Online environment. | |
.PARAMETER ListName | |
Specifies the name of the SharePoint Online list. | |
.NOTES | |
Author: | |
Expiscornovus | |
Current Version: | |
0.1 | |
Version History: | |
0.1 - First minor version | |
.EXAMPLE | |
PS> .\create_courseregistration_spolist.ps1 -SiteCollection "https://contoso.sharepoint.com/sites/formatting" -ListName "Courses" | |
#> | |
param ([Parameter(Mandatory)]$SiteCollection,[Parameter(Mandatory)]$ListName) | |
Connect-PnPOnline -Url $SiteCollection -Interactive | |
New-PnPList -Title $ListName -Template GenericList | |
Add-PnPField -List $ListName -DisplayName "Registration End Date" -InternalName "RegistrationEndDate" -Type DateTime | |
Add-PnPField -List $ListName -DisplayName "Course Date" -InternalName "CourseDate" -Type DateTime | |
Add-PnPField -List $ListName -DisplayName "Register" -InternalName "Register" -Type Text | |
Add-PnPField -List $ListName -DisplayName "Number of Available Places" -InternalName "NumberofPlaces" -Type Number | |
Add-PnPFieldFromXml -List $ListName -FieldXml '<Field Type="UserMulti" DisplayName="People Who Registered" UserSelectionMode="PeopleOnly" StaticName="PeopleWhoRegistered" Name="PeopleWhoRegistered" Mult="TRUE" />' | |
Add-PnPView -List $ListName -Title "All Courses" -Fields "Title","RegistrationEndDate","CourseDate","Register","NumberofPlaces","PeopleWhoRegistered" | |
Disconnect-PnPOnline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment