Skip to main content
2 of 2
replaced http://sharepoint.stackexchange.com/ with https://sharepoint.stackexchange.com/

There is no "get by URL" method for lists in the client object model that I am aware of.

About the closest thing you have is a GetFolderByServerRelativeUrl on the Web object:

ClientContext.Web.GetFolderByServerRelativeUrl(url)

Depending on what you want to do this might work for you...unfortunately you can't get the parent list from the folder object like you can in the .NET api.

Source - Similar question

Since you can't get a list by URL so I would assume you can't get a document by url either, but you can try doing it this way tho,

var fileItem = Web.GetFileByServerRelativeUrl("server/relative/url");

context.Load(fileItem); //you will probably need to load the ListItemAllFields property here.
context.ExecuteQuery();

var listItem = fileItem.ListItemAllFields; 

Console.WriteLine(listItem["Title"]);

Source - getlistitemstrurl-equivalent-for-clientcontext

Hope it helps :)

Muhammad Raja
  • 9.3k
  • 7
  • 44
  • 85