Set Sharepoint Url field

02/06/2015 10:07

 SPListItem item = list.GetItemById(2);
 string fieldName = "myFieldInternalName";
 SPField urlField = item.Fields.TryGetFieldByStaticName(fieldName);
 if (urlField != null)
 {
  SPFieldUrlValue urlValue = new SPFieldUrlValue();
  urlValue.Url = siteUrl;
  urlValue.Description = siteUrl;

  item[fieldName] = urlValue;
  item.Update();
 }