SPSite.OpenWeb method (String, SPSiteOpenWebOptions)

Returns the Web site that is located at the specified server-relative or site-relative URL and applies specified options to it.

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

Syntax

'Declaration
Public Function OpenWeb ( _
    strUrl As String, _
    options As SPSiteOpenWebOptions _
) As SPWeb
'Usage
Dim instance As SPSite
Dim strUrl As String
Dim options As SPSiteOpenWebOptions
Dim returnValue As SPWeb

returnValue = instance.OpenWeb(strUrl, _
    options)
public SPWeb OpenWeb(
    string strUrl,
    SPSiteOpenWebOptions options
)

Parameters

  • strUrl
    Type: System.String

    A string that contains either the server-relative or site-relative URL of the Web site or of an object within the Web site. A server-relative URL begins with a forward slash ("/"), while a site-relative URL does not begin with a forward slash.

Return value

Type: Microsoft.SharePoint.SPWeb
An SPWeb object that represents the Web site.

See also

Reference

SPSite class

SPSite members

OpenWeb overload

Microsoft.SharePoint namespace