【问题标题】:Feature deactivation code behind in Sandbox solution沙盒解决方案中的功能停用代码
【发布时间】:2014-08-11 03:33:18
【问题描述】:

只是一个问题来澄清我的疑问!

我使用 Visual Studio 2010 for SharePoint 2010 创建了沙盒解决方案。

解决方案仅包含一个列表实例,当部署该功能时,会在站点上创建一个列表。

现在,我还希望在禁用该功能时删除列表。

为此,我在 EventReceiver.cs 中编写了以下代码。

public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { using (SPSite site = new SPSite("http://sitecollection")) { SPWeb web = site.RootWeb; SPList list = web.Lists["listname"]; list.Delete(); list.Update(); web.Update(); } }

虽然这确实会删除功能停用列表,但我的问题是,

为什么这个项目仍然是沙盒解决方案(没有 dll 部署到 GAC),因为它包含服务器端 & 和代码隐藏文件?

谢谢,

图沙尔

【问题讨论】:

    标签: c# visual-studio-2010 sharepoint-2010


    【解决方案1】:

    沙盒解决方案可以使用服务器端代码。不同之处在于代码在服务器上单独的 Windows 服务中运行,而不是在 w3wp 进程或 owstimer 中运行。代价是您无法访问所有服务器端功能(例如,您无法使用沙盒解决方案部署计时器作业)。您可以阅读有关沙盒解决方案的更多信息here

    【讨论】:

      猜你喜欢
      • 2013-03-02
      • 2011-08-09
      • 1970-01-01
      • 2011-06-01
      • 2013-12-02
      • 1970-01-01
      • 2011-01-10
      • 2017-10-16
      • 1970-01-01
      相关资源
      最近更新 更多