Programmatically get 14 hive path in sharepoint 2010
I need to get 14 hive path开发者_运维技巧 using code in C#.net.
can any one tell me how can I do this?
You can access the physical path using SPUtility - the web path by looking at the SPWeb object.
Using SPUtility to get the SetupPath of Sharepoint like so:
using Microsoft.SharePoint.Utilities;
string spSetupPath = SPUtility.GetGenericSetupPath(string.Empty);
//e.g. returns "C:\Program Files\Common files\Microsoft Shared\Web Server Extensions\14
- MSDN documentation SPUtility.GetGenericSetupPath
- Example usages of SPUtility.GetGenericSetupPath (e.g. getting the templates dir)
Or you can use SPWeb's server relative URL method:
using Microsoft.Sharepoint;
string spServerURL = SPWeb.ServerRelativeUrl;
MSDN documentation SPWeb.ServerRelativeURL
Also have an overview of the Sharepoint 2010 14 hive structure.
加载中,请稍侯......
精彩评论