kwizcom banner advertisement

Create Task List in SharePoint using PowerShell

Requirement:  In SharePoint, create task list using PowerShell!

PowerShell to create task list in SharePoint:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$WebURL="http://intranet.crescent.com"
$ListName="Project Tasks"
$ListDescription ="Task list to manage project tasks"

#Task list template
$ListTemplate = [Microsoft.SharePoint.SPListTemplateType]::Tasks

#Get the Web
$Web = Get-SPWeb $WebURL

#Check if the task list exists already
$TaskList = $Web.Lists.TryGetList($ListName)
if($TaskList -ne $null)
{
    Write-host "Task list '$($ListName)' exists already!" -ForegroundColor Red
}
else
{
    #Create the task list
    $Web.Lists.Add($ListName,$ListDescription,$ListTemplate) | Out-Null

    #Set "Show in Quick Launch" property for the list
    $TaskList = $Web.Lists[$ListName]
    $TaskList.OnQuickLaunch = $True
    $TaskList.Update()

    Write-host "Task list '$($ListName)' Created successfuly!" -ForegroundColor Green
}
This PowerShell script creates SharePoint task list.
sharepoint 2013 powershell create task list

To Add a task in Task list using PowerShell, use: Create a Task in SharePoint Task List using Powershell
Create Task List in SharePoint using PowerShell Create Task List in SharePoint using PowerShell Reviewed by Salaudeen Rajack on March 27, 2016 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.