Share via


get the physical path

Question

Wednesday, May 2, 2012 11:21 AM

hi 
I need to get the real path of a document

http://postimage.org/image/i7q9j717r/

then sharepoint redirect me to this virtual path

http://postimage.org/image/fmuc6j7jb/

you can see 

http://postimage.org/image/polx39xsf/

thanks

[url=http://postimage.org/image/polx39xsf/][img]http://s11.postimage.org/polx39xsf/Capture3.jpg[/img][/url]

All replies (8)

Thursday, May 3, 2012 8:38 AM âś…Answered | 2 votes

Hi makachakh90,

The SharePoint library documents are stored in SharePoint Content database in SQL, you can not find the physical path of it, here is an article related to this topic.

When you click "Open with Explorer" in library Ribbon, it will display the library as "Explorer View" like in file system, but it is not the real physical path, which is implement via the WebDAV protocol, reference below is extracted from this article,

"WebDAV is a simple extension to the HTTP protocol based on a public specification. It provides an extended vocabulary that defines how basic file functions, such as copy, move, delete, and create folder, are performed across HTTP. "

You need to write code to get the documents, here are some similar posts,

Accessing Documents in Sharepoint programmatically

How can I get/download SharePoint files (Doc/Image) programmatically

How to Move SharePoint Document Library Files Programmatically C#

Thanks

Daniel Yang

TechNet Community Support


Wednesday, May 2, 2012 11:41 AM

Hi ,

Map the physical path in iis with virtual diractory.

may be it will solve your problum.


Wednesday, May 2, 2012 1:10 PM

please more explanation i didn't understand
if possible a tutorial or a link 
thanks 


Wednesday, May 2, 2012 1:32 PM

Hi

What do you need the "real" path for? The path that is displayed in the file properties dialog in windows explorer is the WebDav path of the document being provided by SharePoint. So this is not really the "real" path. So in order to provide you with the correct advice, it would be good to know what exactly you need the path for.

Regards, Christian


Wednesday, May 2, 2012 1:53 PM

my project is a sharepoint installer (i retrieve a web site from a site collection than i move it to it's new environment)
so i should focus on the content of each web site.
now i need to know thereal path of those files and folders 


Wednesday, May 2, 2012 2:40 PM

You could do something like this:

byte[] sourceFile;using(SPSite sourceSite = new SPSite("http://sourcesite")){  var web = sourceSite.OpenWeb("NameOfTheSourceWeb");  var item = web.GetListItem("ServerRelativeWebPath/documents/myDocument.doc");  var file = item.File;    sourceFile = file.OpenBinary();}var targetUrl = "myDocument.doc";using(SPSite targetSite = new SPSite("http://targetsite")){  var web = targetSite.OpenWeb("NameOfTheTargetWeb");  var list = web.Lists["TargetList"];  var folder = list.RootFolder;  folder.Files.Add(targetUrl, sourceFile); }

Wednesday, May 2, 2012 4:54 PM

I think that these files and folders are stored in the Databases 
is that true??
plz somz help to get the physical path !!


Wednesday, May 2, 2012 9:05 PM

data in list and libraries of SharePoint are stored in content DB as such there is no physical location its in sql server until you have not mapped a physical location as Virtual Directory in IIS for storing BLOB , you have to  take backup and restore in new environment or use power-shell scripts or custom code to to copy all the data with properties from existing environment to new environment.