We want to create a new column called "Year" (Tasks > Settings > Create Column) and set a default value to "2016". Default value is already displayed when we create new task, but we have a lot of tasks we created before. Is there any way we can add default value to existing tasks?
1 Answer
You have to code for the same, you cannot achieve using OOTB(Out Of the Box) functionality.
Options: Client Side(from Browser):
- Rest API
- JavaScript Object Model
C#:
- Server Object Model
- Client Object Model
Also if you have handy knowledge of power shell, you can write power shell script to achieve the same.
# Add SharePoint PowerShell Snapin
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
Add-PSSnapin Microsoft.SharePoint.Powershell
}
$web = get-spweb http://site/web
$lists = $web.Lists["list name"]
$items = $lists.items
foreach($item in @($items))
{
$item["ColumnName"] = $NewValue
$item.update()
}
$list.update()