允许SharePoint Web部件写入文件系统

允许SharePoint Web部件写入文件系统,sharepoint,sharepoint-2010,Sharepoint,Sharepoint 2010,因此,我一直在拼命尝试允许我的SharePoint项目将xml文件写入项目目录中的临时位置,但没有成功 当我尝试时: myDataTable.WriteXml("path to folder in project", true); 我遇到了: "Access to path is Denied" 现在我以前也遇到过这个问题,并且已经解决了,但它对我的sharepoint项目不起作用。有什么建议吗?在调用此方法之前,您可能需要提升代码中的权限。查看spsecurity.runwitheleva

因此,我一直在拼命尝试允许我的SharePoint项目将xml文件写入项目目录中的临时位置,但没有成功

当我尝试时:

myDataTable.WriteXml("path to folder in project", true);
我遇到了:

"Access to path is Denied"

现在我以前也遇到过这个问题,并且已经解决了,但它对我的sharepoint项目不起作用。有什么建议吗?

在调用此方法之前,您可能需要提升代码中的权限。查看
spsecurity.runwithelevatedprivileges
方法,将代码作为Sharepoint web apps应用程序池帐户运行。然后,您需要为该帐户授予文件系统的正确权限