SharePoint ServerContext与SPContext

CMN*_*CMN 2 sharepoint

在什么情况下你应该使用ServerContext而不是SPContext(反之亦然)?提出了哪些优点/缺点/限制?我似乎无法找到关于此的大量信息.

Jan*_*rgs 5

来自MSDN:

ServerContext类(Microsoft.Office.Server)为Microsoft Office SharePoint Server 2007中的共享服务提供运行时方法.

  1. 首先,正如我所看到的,ServerContext仅在MOSS中可用.
  2. 上述MSDN 站点中的示例显示,要获取共享服务userprofiles,您需要ServerContext.

这是两个不同的类,甚至没有一个继承.您可以使用ServerContext获取当前列表项,列表,Web或站点实例吗?比较SPContextServerContext成员,你会发现自己的差异.