Requirement: Create Announcement List in SharePoint Online.
How to Create an Announcement list in SharePoint Online?
As its name indicates, the Announcements list in SharePoint Online is used to share announcements and news. It has “Title” and “Body” fields for announcement and also has “Expiration Date” to set whether a particular announcement is to be listed or not. Here is how to create an announcement list in SharePoint Online:
- Navigate to the SharePoint Online Site >> Click on Settings Gear >> Select “Add an App”
- From the Apps page, Click on “Announcements” Tile
- Provide the name to your announcement list and click on Create.
This creates an announcement list in SharePoint Online. Announcements lists are typically added to the home page of the sites.
SharePoint Online: PowerShell to Create Announcement List
Announcements lists are used to share news and announcements messages. Here is the PowerShell CSOM script to create an announcement list in SharePoint Online.
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Parameter Values $SiteURL="https://crescent.sharepoint.com" $ListName="Townhall" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Cred #Set creating data for announcement list $CreationInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation $CreationInfo.Title = $ListName $CreationInfo.TemplateType = [int][Microsoft.SharePoint.Client.ListTemplateType]::Announcements $CreationInfo.Description = "$ListName Announcements" #Create Announcement in SharePoint Online $List = $Ctx.web.Lists.Add($CreationInfo) $Ctx.ExecuteQuery()
PnP PowerShell to Create Announcement List
#Set Variables $SiteURL = "https://crescent.sharepoint.com/sites/purchase" $ListName = "Announcements" #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Interactive #Create Announcement List New-PnPList -Title $ListName -Template Announcements