Sunday, June 7, 2015

Set Default Value for Hyperlink or Picture Column in SharePoint

Problem:
There is no provision for specifying default value in Hyperlink or Picture type columns in SharePoint! In some scenarios, we may want to specify SharePoint 2010/2013 hyperlink column default value. But there is no option in SharePoint web UI to enter hyperlink field default value!

sharepoint 2010 hyperlink field default value

Solution: Set SharePoint hyperlink column default value with PowerShell! Use this PowerShell script to specify default value for hyperlink or picture type fields.

Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

#Variables
$WebURL="http://intranet.crescent.com"
$ListName="Proposal Documents"
$ColumnName="Reference URL"
$DefaultValue="http://externalsites.crescent.com" 

#Get the Web
$web = Get-SPWeb $WebURL
 
#Get the List
$list = $web.Lists.TryGetList($ListName)
 
If($list -ne $null)
{
 #Get the column
 $column = $list.Fields[$ColumnName]

 if($column -ne $null)
 {
     #Set Default Value
     $column.DefaultValue = $DefaultValue
  $column.Update()
     $list.Update()
  Write-Host " Default value set for the column!" 
 }
 }
$web.Dispose() 

Here is the output for SharePoint 2013 list hyperlink default value specified programmatically:
 sharepoint 2013 hyperlink column default value



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