Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 down vote accepted
docLib = Context.Web.Lists.GetByTitle("Your Doclib Name");


string serverRelativeUrl = docLib.RootFolder.ServerRelativeUrl;
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.