Thursday, June 18, 2015

Create a Task in SharePoint Task List using Powershell

PowerShell Script to Create a New Task in SharePoint Task List:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Parameters

#Get web and List objects
$Web = Get-SPWeb $WebURL
$TaskList = $Web.Lists[$TaskListName]

$NewTaskItem = $TaskList.AddItem()

#Set value for Task list columns
$NewTaskItem["Title"] = "New Task"
$NewTaskItem["StartDate"]= (Get-Date).ToShortDateString()
$NewTaskItem["DueDate"] =(Get-Date).AddDays(7)
$NewTaskItem["Status"]="Not Started"
$NewTaskItem["Priority"]= "(1) High"


Write-host "New Task Item Created Successfully!"
and here is the new task created in SharePoint 2016 task list:
create new task item in Task list of SharePoint using PowerShell

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

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...