Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

Microsoft.SharePoint.dll APIs That Are Available from Sandboxed Solutions

SharePoint 2010

Published: May 2010

This topic provides guidance about which APIs in the Microsoft.SharePoint.dll assembly can be called from code in a sandboxed solution.

Available in SharePoint Online

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, and only assemblies in the global assembly cache can be called. 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 and Available and Unavailable SharePoint Assemblies from Sandboxed Solutions in SharePoint 2010.

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.

  • Only a subset of the APIs in Microsoft.SharePoint.dll are available in sandboxed solutions.

  • However, those APIs that are available run in a special, fully trusted process and therefore are not subject to the restrictions of the sandboxed worker process. For example, the GetLocalizedString method can be called from a sandboxed solution even though it reads from the disk, something that is not allowed by code that actually runs within the sandboxed worker process.

  • Certain methods in Microsoft.SharePoint.dll can be called in sandboxed solutions only if the calling code conforms to certain restrictions on the values of the passed parameters. Also, certain properties in Microsoft.SharePoint.dll are read/write in farm solutions but read-only in sandboxed solutions. For more information, see Methods and Properties That Are Available with Restrictions later in this topic.

Microsoft.SharePoint.dll Namespaces That Are Available in Sandboxed Solutions

Classes That Are Available in Sandboxed Solutions

Methods and Properties That Are Available with Restrictions

Each of the following namespaces has at least one class that can be called from a sandboxed solutions. The specific classes are listed in the tables in the next section.

  • Microsoft.SharePoint

  • Microsoft.SharePoint.Administration

  • Microsoft.SharePoint.Navigation

  • Microsoft.SharePoint.UserCode

  • Microsoft.SharePoint.Utilities

  • Microsoft.SharePoint.WebControls

  • Microsoft.SharePoint.WebPartPages

  • Microsoft.SharePoint.Workflow

Each of the following types has at least one member that can be called in a sandboxed solution. To find out whether a particular member is allowed in a sandboxed solution, view the SDK reference topic for the member. Near the top of the topic is an indication of whether it is available.

Caution note Caution

Do not create a static (Shared in Microsoft Visual Basic) field or property in code that runs in a sandboxed solution. Doing this is not supported.

Microsoft.SharePoint Namespace

DefaultItemOpen

DraftVisibilityType

NameValuePair

OfficialFileResult

PAGETYPE

SPAddFieldOptions

SPAlert

SPAlertCollection

SPAlertDeliveryChannels

SPAlertFrequency

SPAlertStatus

SPAlertTemplate

SPAlertType

SPAttachmentCollection

SPBaseCollection

SPBasePermissions

SPBaseType

SPBrowserFileHandling

SPBuiltInContentTypeId

SPBuiltInFieldId

SPBusinessDataField

SPCalendarType

SPCalendarViewStyle

SPCalendarViewStyleCollection

SPChange

SPChangeAlert

SPChangeCollection

SPChangeCollection.CollectionScope

SPChangeContentType

SPChangeField

SPChangeFile

SPChangeFolder

SPChangeGroup

SPChangeItem

SPChangeList

SPChangeQuery

SPChangeSecurityPolicy

SPChangeSite

SPChangeToken

SPChangeTokenCollection

SPChangeType

SPChangeUser

SPChangeView

SPChangeWeb

SPCheckedOutFile

SPCheckinType

SPChoiceFormatType

SPCompositeIndexableStatus

SPContentType

SPContentTypeCollection

SPContentTypeId

SPContentTypeUsage

SPContext

SPContextPageInfo

SPCopyDestination

SPCopyDestinationCollection

SPCopyDestinationType

SPCopyFieldInformation

SPCopyFieldMask

SPCustomizedPageStatus

SPCustomWebTemplate

SPDateTimeFieldFormatType

SPDistributionGroupException

SPDocTemplate

SPDocTemplateCollection

SPDocumentLibrary

SPDuplicateValuesFoundException

SPEmailEventReceiver

SPEndpointAddressNotFoundException

SPEventContext

SPEventHostType

SPEventPropertiesBase

SPEventReceiverBase

SPEventReceiverDefinition

SPEventReceiverDefinitionCollection

SPEventReceiverStatus

SPEventReceiverSynchronization

SPEventReceiverType

SPEventType

SPException

SPFeature

SPFeatureCollection

SPFeatureDefinitionScope

SPFeatureDependency

SPFeatureDependencyCollection

SPFeatureProperty

SPFeaturePropertyCollection

SPFeatureQueryResultCollection

SPFeatureReceiver

SPFeatureReceiverProperties

SPFeatureScope

SPField

SPField.ListItemMenuState

SPFieldAllDayEvent

SPFieldAllowEditing

SPFieldAttachments

SPFieldBoolean

SPFieldCalculated

SPFieldCallTime

SPFieldCallTo

SPFieldChoice

SPFieldCollection

SPFieldComputed

SPFieldConfidential

SPFieldConfirmations

SPFieldContactInfo

SPFieldCrossProjectLink

SPFieldCurrency

SPFieldDateTime

SPFieldDecimal

SPFieldDueDate

SPFieldFacilities

SPFieldFile

SPFieldFrom

SPFieldGuid

SPFieldIndex

SPFieldIndexCollection

SPFieldLink

SPFieldLinkCollection

SPFieldLookup

SPFieldLookupValue

SPFieldLookupValueCollection

SPFieldModStat

SPFieldMultiChoice

SPFieldMultiChoiceValue

SPFieldMultiColumn

SPFieldMultiColumnValue

SPFieldMultiLineText

SPFieldNumber

SPFieldPageSeparator

SPFieldRatingScale

SPFieldRatingScaleValue

SPFieldRecurrence

SPFieldSendTo

SPFieldText

SPFieldType

SPFieldTypeDefinition

SPFieldTypeDefinitionCollection

SPFieldUntil

SPFieldUrl

SPFieldUrlValue

SPFieldUser

SPFieldUserSelectionMode

SPFieldUserValue

SPFieldUserValueCollection

SPFieldValidationException

SPFieldValueException

SPFieldWhatsNew

SPFieldWhereabout

SPFieldWorkflowStatus

SPFile

SPFile.SPCheckOutType

SPFile.SPLockType

SPFileCheckOutException

SPFileCheckOutExceptionType

SPFileCollection

SPFileCollectionAddParameters

SPFileConversionResult

SPFileConversionState

SPFileLevel

SPFileLockException

SPFileLockExceptionType

SPFileSaveBinaryParameters

SPFileSystemObjectType

SPFileVersion

SPFileVersionCollection

SPFolder

SPFolderCollection

SPForm

SPFormCollection

SPGroup

SPGroupCollection

SPInvalidPropertyException

SPIssueList

SPIssueList.ReportType

SPItem

SPItemEventDataCollection

SPItemEventProperties

SPItemEventReceiver

SPLanguage

SPLanguageCollection

SPLink

SPLinkCollection

SPList

SPListCategoryType

SPListCollection

SPListDataSource

SPListDataValidationException

SPListDataValidationException.SPFailure

SPListDataValidationException.SPReason

SPListDataValidationException.SPValidationType

SPListEventProperties

SPListEventReceiver

SPListItem

SPListItemCollection

SPListItemCollectionPosition

SPListItemInfo

SPListItemVersion

SPListItemVersionCollection

SPListTemplate

SPListTemplate.QuickLaunchOptions

SPListTemplateCollection

SPListTemplateType

SPLocale

SPLocaleCollection

SPMember

SPMemberCollection

SPModerationInformation

SPModerationStatusType

SPModule

SPModuleCollection

SPMoveOperations

SPNumberFormatTypes

SPObjectType

SPOfficialFileAction

SPOfficialFileSubmissionMode

SPPermissionGroup

SPPermissionGroup64

SPPermissionInfo

SPPictureLibrary

SPPreviewValueSize

SPPrincipal

SPQuery

SPQueryThrottledException

SPRecycleBinItem

SPRecycleBinItemCollection

SPRecycleBinItemCollectionPosition

SPRecycleBinItemState

SPRecycleBinItemType

SPRecycleBinOrderBy

SPRecycleBinQuery

SPRecycleBinType

SPRegionalSettings

SPRelatedField

SPRelatedFieldCollection

SPRelationshipDeleteBehavior

SPResource

SPResourceScope

SPResourceType

SPRichTextMode

SPRoleAssignment

SPRoleAssignmentCollection

SPRoleDefinition

SPRoleDefinitionBindingCollection

SPRoleDefinitionCollection

SPRoleType

SPSearchResult

SPSearchResultCollection

SPSearchResultCollectionPosition

SPSecurableObject

SPServiceContext

SPSimpleItem

SPSite

SPSite.StorageManagementInformationType

SPSite.StorageManagementSortedOn

SPSite.StorageManagementSortOrder

SPSiteDataQuery

SPTemplateFileType

SPTimeZone

SPTimeZoneCollection

SPUrlFieldFormatType

SPUser

SPUserCollection

SPUserCustomAction

SPUserCustomActionCollection

SPUserCustomActionRegistrationType

SPUserCustomActionScope

SPUserResource

SPUserResourceCollection

SPUserSolution

SPUserSolutionCollection

SPUserSolutionStatus

SPUserStorage

SPView

SPViewCollection

SPViewCollection.SPViewType

SPViewFieldCollection

SPViewFlags

SPViewScope

SPViewStyle

SPViewStyleCollection

SPVirusCheckStatus

SPWeb

SPWebCollection

SPWebEventProperties

SPWebEventReceiver

SPWebListInfo

SPWebTemplate

SPWebTemplate.TeamCollaborationSiteConfiguration

SPWebTemplate.WebTemplate

SPWebTemplateCollection

SPXmlDocumentCollection

Strings

TriState

Microsoft.SharePoint.Administration Namespace

SPAutoSerializingObject

SPFeatureDefinition

SPPersistedObject

SPUrlZone

SPUserCodeAssemblyFileDefinition

SPUserCodeAssemblyGroupId

SPUserCodeCachedAssemblyGroup

SPUserCodeWrapper

Microsoft.SharePoint.Navigation Namespace

SPNavigation

SPNavigationNode

SPNavigationNodeCollection

SPQuickLaunchHeading

Microsoft.SharePoint.UserCode Namespace

SPProxyOperation

SPProxyOperationArgs

SPUserCodeExecutionContext

SPUserCodeValidationFailedException

SPUserCodeWorkflowContext

Microsoft.SharePoint.Utilities Namespace

AttachmentEnumerator

DateOptions

IconSize

ISPIdentifiableObject

ISPPerformanceMonitor

ISPScopedPerformanceMonitor

MoblogUtility

PermissionContext

PermissionMode

SPDateFormat

SPDiffUtility

SPEmailAttachment

SPEmailAttachmentCollection

SPEmailHeader

SPEmailHeaderCollection

SPEmailMessage

SPEncode

SPHttpUtility

SPMonitoredScope

SPPrincipalInfo

SPPrincipalSource

SPPrincipalType

SPRedirectFlags

SPStringUtility

SPUrlUtility

SPUtility

ThemeColor

ThemeFont

ThemeType

ThmxTheme

Microsoft.SharePoint.WebControls Namespace

SPControlMode

SPDataSourceMode

Microsoft.SharePoint.WebPartPages Namespace

BrowserBuilderType

DesignerBuilderType

FriendlyNameAttribute

HtmlDesignerAttribute

ManagedLinkAttribute

Permissions

SPAttachedProperty

SPWebCategoryNameAttribute

SPWebPartManager

Storage

WebPartPageUserException

WebPartZone

Microsoft.SharePoint.Workflow Namespace

ISPWorkflowEventReceiver

SPWorkflow

SPWorkflowActivationProperties

SPWorkflowAssignedToFilter

SPWorkflowAssociation

SPWorkflowAssociationCollection

SPWorkflowAssociationCollection.Configuration

SPWorkflowCollection

SPWorkflowEventCompletionType

SPWorkflowEventProperties

SPWorkflowEventReceiver

SPWorkflowExternalDataExchangeService

SPWorkflowExternalDataExchangeServiceCollection

SPWorkflowFilter

SPWorkflowManager

SPWorkflowModification

SPWorkflowModificationCollection

SPWorkflowPostponedEventType

SPWorkflowRunOptions

SPWorkflowState

SPWorkflowTask

SPWorkflowTaskCollection

SPWorkflowTaskProperties

SPWorkflowTemplate

SPWorkflowTemplateCollection

SPWorkflowWorkflowRoleCreator

The following table lists methods that can be called from sandboxed solutions only if calling code conforms to certain restrictions on the parameters that are passed.

Method

Restriction

SPSite.SPSite(Guid)

The GUID that is passed to this constructor must be the ID of the current site collection.

SPSite.SPSite(String)

The URL that is passed to this constructor must resolve to the current site collection.

The following table lists properties that are read/write in farm solutions, but are read-only in sandboxed solutions.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.