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

how can i create a link to a document in a library in c# using the object model in sharepoint 2010?

share|improve this question
You tagged the client object model... Is it that object model of the full object model ? – Sébastien Levert Dec 18 '10 at 21:16
Hi, can you elaborate on what you mean by "create a link to a document"? – Rob D'Oria Dec 18 '10 at 21:17
up vote 0 down vote accepted

A combination of SPList and SPListItem.GetItems will do the job. Note that SPListeItem has a ".URL" field.

The links have sample code that is a good start.

share|improve this answer

In fact, I would go with the following solution, if you are using the regular object model. I can't tell if that it would work also with the client object model.

Use the Content Type "Link To a Document" and use the following code to make it work. I had to do it for one of my projects, and it is definitely the way to go.

Check it here

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.