tags:

views:

389

answers:

1

I need to know how to insert a list item with a hyperlink field using the oob web services.

I already have the code to do the insert, just not sure about the hyperlink.

Here is a standard text field (just part of the code):

+ @"<Field Name=""Annotation"">" + this.messageEnvelope.DM.Annotation + "</Field>"

Now how can I insert a hyperlink , there is absolutely no documentation on this. Thanks in advance

+1  A: 

SharePoint stores its links in this format (note the comma and space between the URL and the description):

url, description
http://example.com, An Example

I'm not sure about the web service, but it should work just the same.

From code, you can use the SPFieldUrlValue class to format this value:

SPFieldUrlValue urlVal = new SPFieldUrlValue();
urlVal.Url = "http://example.com";
urlVal.Description = "An Example";
string spUrlFormat = urlVal.ToString();
Kobi
testing this now
JL
It worked, but its worth noting that the hyperlink should be a valid link, even during testing , else will produce an object reference not set.
JL