我需要在布局文件夹中保留一些数据/文件。我的 SharePoint 项目是“MyProject”因此目录结构包括
"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MyProject"
现在我需要以编程方式创建一个名为“Data”的新文件夹。但我收到“拒绝访问”错误。
SPSecurity.RunWithElevatedPrivileges(delegate
{
String path = SPUtility.GetGenericSetupPath(String.Empty) + "TEMPLATE\\LAYOUTS\\MyProject\\Data";
bool IsExists = System.IO.Directory.Exists(path);
if (!IsExists)
System.IO.Directory.CreateDirectory(path);// Access denied!
});
谁能告诉我为什么我的访问被拒绝?即使我已将代码包装在 RunWithElevatedPrivileges 中?