我正在使用以下代码从sharepoint访问Web应用程序。SharePoint:SPContext.Current在SharePoint Foundation 2010中返回null
SPWebApplication webApplication = SPContext.Current.Site.WebApplication;
它正常工作与SharePoint服务器2010(MOSS2010)。但是,当我使用SharePoint Foundation 2010(WSS4.0)SPContext.Current始终返回null。谁能告诉我可能是什么原因呢?我该如何解决这个问题?
感谢和问候, Sharmila
确定'SPContext看看这里。当前'是'null'?此代码在哪里运行(WebPart/Console Application/TimerJob)? – Stefan 2012-01-04 10:46:53
Yes.SPContext.Current返回null。代码在webpart中运行 – Mishal 2012-01-04 11:32:19
这是一个沙盒解决方案(在Foundation环境中)? – 2012-01-05 12:47:50