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

To upload a file using File.SaveBinaryDirect you have to know the server relative URL of the document library you're working with.

Example from MSDN :-

ClientContext clientContext = new ClientContext("");
using (FileStream fileStream = new FileStream("NewDocument.docx", FileMode.Open))
            "/Shared Documents/NewDocument.docx", fileStream, true);

How can you determine a Document Libraries url?

share|improve this question
up vote 5 down vote accepted
docLib = Context.Web.Lists.GetByTitle("Your Doclib Name");


string serverRelativeUrl = docLib.RootFolder.ServerRelativeUrl;
share|improve this answer
There has got to be a better way to do this. I'm trying to upload a document FAST. That's why I'm using SaveBinaryDirect. This is SLOOOOOOOOOOOW. – Michael Blackburn Jul 5 at 21:21

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.