Sunday, March 27, 2016

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



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!


You might also like:

Related Posts Plugin for WordPress, Blogger...