简体   繁体   中英

How to get the subdirectory in virtual directory of a sharepoint web application?

I have a subdirectory called "Holidays" in my sharepoint virtual directory. "Holidays" ahs other subdirectories like "2010,"2011,"2012" I am trying to read the files under the subdirectory of holiday and display the lists of all the files.

I am not able to get a map to the virtual directory so far. How can i get a physical path map so that i can treat the path as a directory and write retrieve all the files than end with .html and display.

so far i have tried this

SPWebApplication _webapp = SPContext.Current.Site.WebApplication;
ltr_test.Text = _webapp.IisSettings[SPUrlZone.Default].Path.ToString();

it gives me an output like this

C:\inetpub\wwwroot\wss\VirtualDirectories\mywebsite.com

what i am looking for is this

C:\inetpub\wwwroot\wss\VirtualDirectories   

what changes i have to make any help

Well , then you can put it as a parameter in Path.GetDirectoryName() method?

Path.GetDirectoryName(@"C:\inetpub\wwwroot\wss\VirtualDirectories\mywebsite.com")

should return

C:\inetpub\wwwroot\wss\VirtualDirectories 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM