SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently adding the URL except the description is an ugly link. I would like to add the description to the URL in a links list on sharepoint online.

My current code to add a new item from an Azure Worker role is as follows :

        using (ClientContext ctx = new ClientContext(cmdSpoSite))
            ctx.ExecutingWebRequest += new EventHandler<WebRequestEventArgs>(ctx_ExecutingWebRequest);

            if (ctx != null)
                List oList = ... // List data etc

                oListItem["Title"] = System.Guid.NewGuid().ToString();
                oListItem["URL"] = url;
                // Adding the URL here but how do I change the description?



The description as seen from the sharepoint list:

enter image description here


FieldUrlValue _url = new FieldUrlValue();
_url.Url = "";
_url.Description = "Google";
oListItem["URL"] = _url;
share|improve this question
up vote 7 down vote accepted
SPFieldUrlValue url = new SPFieldUrlValue();
url.Url = "Your Url here";
url.Description = "Your description here";
oListItem["URL"] = url;

EDIT (for CSOM):

FieldUrlValue url = new FieldUrlValue();
url.Url = "Your Url here";
url.Description = "Your description here";
oListItem["URL"] = url;
share|improve this answer
Cheers, seems like this is in the Microsoft.Sharepoint assembly. Any way I could use SPFieldUrlValue in the sharepoint redistributeable. Microsoft.SharePoint.Client – f0x Apr 6 '12 at 16:35
Thanks mate, it wouldnt compile with object does not contain a defintion ... So i just instantiated a new FieldUrlValue as seen in my edit above; thank you kindly for your assistance. – f0x Apr 6 '12 at 18:08
Np dude. Glad to help. – RJ Cuthbertson Apr 6 '12 at 18:12

I wasn't able to find a Microsoft.SharePoint.dll for O365 2013. Here is how I did it, cheers:

           ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            var lib = ctx.Web.Lists.GetByTitle("All Project List");
            li = lib.AddItem(itemCreateInfo);
            li["Title"] = "New Item";
            Microsoft.SharePoint.Client.FieldUrlValue u = new Microsoft.SharePoint.Client.FieldUrlValue();
            u.Url = "";
            u.Description = "title";
            li["Project"] = u;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.