Error When Creating Links List Items (Hyperlinks)

In my case, I was using PowerShell to create a bunch of links to folders on a file-share in a SharePoint list. I came across errors when I used the 2010 method in 2013. Below I have provided examples of each method:

2010

$urlValue = New-Object Microsoft.SharePoint.SPFieldUrlValue("")
$urlValue.Description = "This is an awesome description"
$urlValue.Url =  "http://MyUrl.com"
$item["URL"] = $urlValue
$item.update()

2013

$newItem = $list.Items.Add()
$newItem["URL"] = "$urlString , $descriptionString"
$newItem["Comments"] = $descriptionString
$newItem.Update()

 

Leave a comment