How to deal with URL fields in SharePoint Lists programmatically
Posted
Wednesday, October 24, 2007 4:17 PM
by
Itay Shakury
What seems to be a simple task has very little examples on the web.
This is one quick way:
//Assuming You have an SPWeb object called "web"
SPList list = web.Lists["YourList"]; //Get a list
SPListItem item = list.Items[0]; //Get an item
item["Link Field"] = "http://blogs.microsoft.co.il/blogs/itaysk, itaysk"; //equivalent to <a href="http://blogs.microsoft.co.il/blogs/itaysk" mce_href="http://blogs.microsoft.co.il/blogs/itaysk"> itaysk </a>
item.Update();
What do we learn? That the URL is stored as a string that contains both the URL it's display text, seperated by a comma.