Receiving error of “The type or namespace name 'LayoutsPageBase' could not be found”

萝らか妹 提交于 2019-12-10 18:34:32

问题


To give you entire perspective, I am trying to create a custom ribbon in SharePoint. For that I am following this tutorial. I created the required feature and was able to deploy and test it with simple JavaScript alert. Now I am trying to call an ASPX page on click of ribbon button.

For that I created an Application Page in my project. But in the code behind file of ASP.NET page I get the following error:

The type or namespace name 'LayoutsPageBase' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\Administrator\Documents\Visual Studio 2012\Projects\CustomRibbonButton\CustomRibbonButton\Layouts\CustomRibbonButton\ApplicationPage1.aspx.cs

I have imported (I hope thats what you call it in C#) Microsoft.SharePoint.WebControls with statement using Microsoft.SharePoint.WebControls;

From this question on StackOverflow I was able to figure that LayoutsPageBase class is not available in sandbox solutions (with path as \UserCode\assemblies).

So in my project I went to References > Microsoft.SharePoint, right-clicked on it to view its Properties. Its Path in Properties window is shown as C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll.

What can be the reason for this error and how can it be solved?


回答1:


You can check whether or not a SharePoint project is Sandboxed by right clicking the project in Solution Explorer and viewing the properies.

There is a true/false property called Sandboxed Solution.



来源:https://stackoverflow.com/questions/20741291/receiving-error-of-the-type-or-namespace-name-layoutspagebase-could-not-be-fo

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