Get and Set a SharePoint URL Field Value Using Server Object Model C#

At this hint, I explains How to Get and Set a SharePoint URL Field value using Server Object Model C#

To set a SharePoint URL Field value


Field Class: SPFieldUrl
Field Value Class: SPFieldUrlValue

SPFieldUrlValue urlValue = new SPFieldUrlValue();
urlValue.Url = "";
urlValue.Description = "Google";
item["FieldName"] = urlValue;

To get a SharePoint URL Field value

SPFieldUrlValue urlValue = new SPFieldUrlValue(item["FieldName"].ToString());
string url = urlValue.Url;
string description = urlValue.Description;

Enjoy 🙂

See also


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s