![](/img/trans.png)
[英]“The type or namespace name 'OfficeOpenXml' could not be found” error
[英]Receiving error of “The type or namespace name 'LayoutsPageBase' could not be found”
為了給您提供全部視角,我嘗試在SharePoint中創建自定義功能區。 為此,我正在學習本教程 。 我創建了所需的功能,並能夠使用簡單的JavaScript警報進行部署和測試。 現在我試圖點擊功能區按鈕調用ASPX頁面。
為此,我在項目中創建了一個應用程序頁面。 但是在ASP.NET頁面的代碼隱藏文件中,我收到以下錯誤:
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
我已經導入了(我希望你在C#中稱之為) Microsoft.SharePoint.WebControls
with using Microsoft.SharePoint.WebControls;
從StackOverflow上的這個問題我可以看出LayoutsPageBase
類在沙盒解決方案中不可用(路徑為\\UserCode\\assemblies
)。
所以在我的項目中,我去了References > Microsoft.SharePoint
,右鍵單擊它以查看其屬性。 其“屬性中的Path
窗口顯示為C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\15\\ISAPI\\Microsoft.SharePoint.dll
。
這個錯誤的原因是什么?如何解決?
通過右鍵單擊解決方案資源管理器中的項目並查看屬性,可以檢查SharePoint項目是否為沙箱。
有一個名為Sandboxed Solution
的真/假屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.