Skip to main content
Commonmark migration
Source Link

I am going through a code which is trying to make URL for a document within a document library,

string mydocumentpath = "https://" + spSite.HostName +
 MyDocumentlibrary.RootFolder.ServerRelativeUrl;

string mySecretEncodedPath = HttpUtility.UrlPathEncode(mydocumentpath ) + "/";

I am bit confused with where this root folder came from and what does "ServerRelativeUrl" is doing here, I already read this [microsoft.sharepoint.splist.rootfolder.aspx][1]microsoft.sharepoint.splist.rootfolder.aspx but couldn't get answer I want.

Also is it alright to change root folder name ?

if it is then what would be the best way of doing it. [1]: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.rootfolder.aspx

I am going through a code which is trying to make URL for a document within a document library,

string mydocumentpath = "https://" + spSite.HostName +
 MyDocumentlibrary.RootFolder.ServerRelativeUrl;

string mySecretEncodedPath = HttpUtility.UrlPathEncode(mydocumentpath ) + "/";

I am bit confused with where this root folder came from and what does "ServerRelativeUrl" is doing here, I already read this [microsoft.sharepoint.splist.rootfolder.aspx][1] but couldn't get answer I want.

Also is it alright to change root folder name ?

if it is then what would be the best way of doing it. [1]: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.rootfolder.aspx

I am going through a code which is trying to make URL for a document within a document library,

string mydocumentpath = "https://" + spSite.HostName +
 MyDocumentlibrary.RootFolder.ServerRelativeUrl;

string mySecretEncodedPath = HttpUtility.UrlPathEncode(mydocumentpath ) + "/";

I am bit confused with where this root folder came from and what does "ServerRelativeUrl" is doing here, I already read this microsoft.sharepoint.splist.rootfolder.aspx but couldn't get answer I want.

Also is it alright to change root folder name ?

if it is then what would be the best way of doing it.

Source Link
Muhammad Raja
  • 9.3k
  • 7
  • 44
  • 85

Does Root folders are created automatically for a document library

I am going through a code which is trying to make URL for a document within a document library,

string mydocumentpath = "https://" + spSite.HostName +
 MyDocumentlibrary.RootFolder.ServerRelativeUrl;

string mySecretEncodedPath = HttpUtility.UrlPathEncode(mydocumentpath ) + "/";

I am bit confused with where this root folder came from and what does "ServerRelativeUrl" is doing here, I already read this [microsoft.sharepoint.splist.rootfolder.aspx][1] but couldn't get answer I want.

Also is it alright to change root folder name ?

if it is then what would be the best way of doing it. [1]: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.rootfolder.aspx