How to get ServerRelativeUrl from Full Url in CSOM code. In server side code SPWeb.GetServerRelativeUrlFromUrl() method which accepts a full, server-relative or site-relative URL as a parameter and returns the server-relative URL.

1 Answer 1


Following code will return the ServerRelativeUrl:

Uri uri = new Uri(fullURL);
string serverRelativeURL = uri.AbsolutePath;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.