다음을 통해 공유


Available and Unavailable SharePoint Assemblies from Sandboxed Solutions in SharePoint 2010

This topic lists the Microsoft SharePoint Foundation and Microsoft SharePoint Server managed code assemblies that are available from sandboxed solutions and those that are unavailable.

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

Not all assemblies in SharePoint Foundation and SharePoint Server can be called from sandboxed solutions.

Note

For information about Microsoft .NET Framework assemblies that are available from sandboxed solutions, see Available and Unavailable .NET Assemblies from Sandboxed Solutions in SharePoint 2010.

Calls from sandboxed solutions to APIs in SharePoint assemblies, other than Microsoft.SharePoint.dll, are subject to the same restrictions as any other calls from sandboxed solutions: Only assemblies with the AllowPartiallyTrustedCallersAttribute can be called, only assemblies that are installed in the global assembly cache can be called, and all APIs that are called are subject to the code access security (CAS) policy and the restricted security token of the sandboxed worker process. For more information, see Restrictions on Sandboxed Solutions in SharePoint 2010.

Warning

The Sandbox Solution framework provides a mechanism for executing user-provided code outside of the IIS worker process. The Sandbox Solution framework should not be used as a mechanism for enforcing security boundaries when executing user code. Sandbox Solutions are not supported as a security boundary with user code, especially code of unknown origin. We advise against executing Sandbox Solutions of unknown origins.

The Microsoft.SharePoint.dll assembly is a special case. Calls from sandboxed solutions to APIs in this assembly are both more and less restricted than calls to other SharePoint APIs. For more information about calls to this assembly from sandboxed solutions, see Sandboxed Solutions Architecture in SharePoint 2010 and Microsoft.SharePoint.dll APIs That Are Available from Sandboxed Solutions.

The following sections list the SharePoint Foundation and SharePoint Server managed code assemblies that have the AllowPartiallyTrustedCallersAttribute and those that do not.

Note

Some SharePoint assemblies contain only classes that we do not support calling in third-party code. Those assemblies are not listed in any of the tables of this topic.

Note

Code in sandboxed solutions may not call unmanaged assemblies.

SharePoint Assemblies That Are Available in the Sandboxed Worker Process

The assemblies that are listed in this section are "available" in sandboxed solutions in the sense that they meet three conditions:

  • There is at least one public API in each of them that we support calling at least in a farm solution.

  • Each assembly has the AllowPartiallyTrustedCallers attribute.

  • Each assembly is deployed to the global assembly cache.

Important

Remember that not every API in an available assembly can be successfully called. Some APIs may require permissions that are not allowed by the process token or CAS policy of the sandboxed worker process. Therefore, it is possible that some, or even all, of the APIs in an assembly that is listed as available cannot be called from a sandboxed solution. In particular note that the CAS policy prevents code in the sandboxed worker process from accessing the SharePoint databases (except for calls to the databases made from Microsoft.SharePoint.dll). Often calls to APIs in SharePoint Foundation and SharePoint Server assemblies other than Microsoft.SharePoint.dll will fail because of this restriction even when the assembly is in the GAC and has the AllowPartiallyTrustedCallers attribute.

Assemblies in SharePoint Foundation

Assembly

Remarks

Microsoft.SharePoint

This assembly is handled differently from the others. For more information, see Sandboxed Solutions Architecture in SharePoint 2010 and Microsoft.SharePoint.dll APIs That Are Available from Sandboxed Solutions.

Microsoft.SharePoint.Linq

Most calls to APIs in this assembly trigger calls to Microsoft.SharePoint.dll. Because all calls to the latter assembly (from the sandboxed worker process) are redirected to the shim version of the assembly, the calls from Microsoft.SharePoint.Linq.dll are first passed through the shim and are ultimately executed by the standard version of Microsoft.SharePoint.dll running in a full trust proxy process. Thus, LINQ to SharePoint can read and write to the content databases. For more information about the shim version of Microsoft.SharePoint.dll, see Sandboxed Solutions Architecture in SharePoint 2010 and Special Versions of the Microsoft.SharePoint.dll Assembly. For more information about LINQ to SharePoint, see Managing Data with LINQ to SharePoint.

Microsoft.SharePoint.Search

Microsoft.SharePoint.Security

Assemblies in SharePoint Server

Assembly

Remarks

Microsoft.SharePoint.Portal

Microsoft.SharePoint.Publishing

Microsoft.SharePoint.Search.Extended.Administration

Microsoft.SharePoint.Search.Extended.Administration.Common

Microsoft.Office.Excel.Server.Udf

Microsoft.Office.Server

Microsoft.Office.Server.Search

Microsoft.Office.Server.UserProfiles

SharePoint Assemblies That Are Unavailable in the Sandboxed Worker Process

Most of the assemblies listed here do not have the AllowPartiallyTrustedCallers attribute.

Assemblies in SharePoint Foundation

Assembly

Remarks

Microsoft.SharePoint.ApplicationPages

Microsoft.SharePoint.ApplicationPages.Administration

Microsoft.SharePoint.WorkflowActions

Microsoft.SharePoint.UserCode

Although this assembly has the AllowPartiallyTrustedCallers attribute, it is not available because it is not deployed to the global assembly cache.

Assemblies in SharePoint Server

Assembly

Remarks

Microsoft.Office.SharePoint.ClientExtensions

Microsoft.SharePoint.Taxonomy

Microsoft.SharePoint.Taxonomy.Intl

Microsoft.Office.Policy

Microsoft.Office.DocumentManagement.AdminPages

Microsoft.Office.DocumentManagement

Microsoft.Office.Excel.Server.WebServices

Microsoft.Office.Server.Search.Connector

Microsoft.Office.Word.Server

Microsoft.Office.Workflow.Actions

Microsoft.Office.Workflow.Pages

Microsoft.Office.Workflow.Tasks

See Also

Concepts

Restrictions on Sandboxed Solutions in SharePoint 2010

Available and Unavailable .NET Assemblies from Sandboxed Solutions in SharePoint 2010

Sandboxed Solutions Architecture in SharePoint 2010

Other Resources

Sandboxed Solutions Resource Center | SharePoint 2010

SharePoint Developer Team Blog

SharePoint Developer Center