Get Directory Path to 12 Hive programmatically

淺唱寂寞╮ 提交于 2019-12-05 14:06:48

You can use the Microsoft.SharePoint.Utilities.SPUtility.GetGenericSetupPath() method. See for more information the WSS SDK: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.getgenericsetuppath.aspx

Why would you need to put xml files in the 12 hive? That way you are working "unsupported" Wouldn't it be easier to just deploy to the TEMPLATE\XML folder?

Have you ever seen a SharePoint installation where the 12-hive was not in the same place as usual? I don't think Microsoft even supports having it somewhere else..

Even so you can probably do a MapPath to the "/_layouts" directory to get the value.

32bit vs. 64bit shouldn't matter because in either case Program Files is c:\Program Files.

What does matter is OS language which can change the literal text of c:\Program Files\Common Files. The right way to get that directory is: System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonProgramFiles);

Then you can use that folder and then concatenate the rest of the items...I don't think those items are language specific.

Just want to add that if you use MapPath() in Sharepoint, you receive a path that points to the location of the website, by default 'Inetpub', such as:

C:\Inetpub\wwwroot\wss\VirtualDirectories\12345\myFolder

The path doesn't point to the 12-hive.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!