i am trying to update 2 hyperlink fields (internal names=Hlink1,Hlink2) in powershell,but i am getting "Value does not fall under expected range" error once it hits $Item.SystemUpdate(), but if i remove the $spqQuery.ViewFields it will work fine with out any problem. (below is the code sample)
$spList = $spWeb.Lists[$List.Title]
$spqQuery = New-Object Microsoft.SharePoint.SPQuery
$spqQuery.Query= "<Query><Where>
<Geq>
<FieldRef Name='ID'/>
<Value Type='Counter'>1
</Value>
</Geq>
</Where></Query>"
$spqQuery.ViewFields = "<ViewFields><FieldRef Name='Title'/><FieldRef Name='Hlink1'/><FieldRef Name='Hlink2'/></ViewFields>"
$spqQuery.ViewFieldsOnly = $true
if($spqQuery -ne $null)
{
$splListItems = $spList.GetItems($spqQuery)
}
Write-Host $splListItems.Count
foreach($Item in $splListItems)
{
$UrlField= new-object Microsoft.SharePoint.SPFieldUrlValue($Item["Hlink1"])
$UrlField.Url=$UrlField.Url
$UrlField.Description = $UrlField.Url.ToString()
$Item[$Field.InternalName]= $UrlField.Description
$Item["Title"]= "abcd"
$Item.SystemUpdate()
}