Wednesday, March 25, 2009

Assign value to a hyperlink column in SharePoint

Problem
I have a hyperlink field/column and want to assign a value to it using an EventHandler or Console Application..

Solution
item["HyperlinkColumnName"] = "http://www.google.mu/, Google Website";

i.e. site url, site name

When you view the list item, it will display "Google Website"
If you specify only the link, i.e. item["HyperlinkColumnName"] = "http://www.google.mu/"; then you'll see http://www.google.mu/ when you view the list item

Note: It is important that you leave a "space" after the "comma" i.e. specifying "http://www.google.mu,Google Website" is not good!!

Cheers
d[-_-]b

No comments:

Post a Comment