SPSite constructor (Guid)

Initializes a new instance of the SPSite class based on the specified ID for a site collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub New ( _
    id As Guid _
)
'Usage
Dim id As Guid

Dim instance As New SPSite(id)
public SPSite(
    Guid id
)

Parameters

  • id
    Type: System.Guid

    The ID that specifies the site collection.

Exceptions

Exception Condition
FileNotFoundException

The site collection could not be found.

Remarks

Warning

This constructor is allowed in sandboxed solutions. In that case, the value of the id parameter must resolve to the value of the ID property of the parent site collection in which the sandboxed solution is deployed. If the value of the id parameter resolves to the value of the ID property of any other site collection, the constructor throws an exception because a sandboxed solution is not allowed to access any SharePoint objects outside of its hosting site collection.

See also

Reference

SPSite class

SPSite members

SPSite overload

Microsoft.SharePoint namespace