Compartilhar via


OpenWeb() Method

The OpenWeb method of the SPSite class returns the site associated with the URL used in the SPSite constructor.

Return Value

A Microsoft.SharePoint.SPWeb object that represents the site.

Remarks

When used in conjunction with the SPSite constructor, the OpenWeb method returns the lowest-level site specified by the URL that is passed as parameter for the constructor. See the OpenWeb(String) method overload for more information on using the OpenWeb method with the SPSite constructor.

Example

The following example returns the site located at http://Server_Name/sites/Site_Name/Subsite_Name.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security