[英]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.
“假日”还有其他子目录,例如“ 2010”,“ 2011”,“ 2012”,我正在尝试阅读holiday子目录下的文件,并显示所有文件的列表。
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.
我如何获取物理路径映射,以便可以将路径视为目录并写入以.html结尾并显示的方式检索所有文件。
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()
方法中的参数了吗?
Path.GetDirectoryName(@"C:\inetpub\wwwroot\wss\VirtualDirectories\mywebsite.com")
should return 应该回来
C:\inetpub\wwwroot\wss\VirtualDirectories
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.