SPWeb.ServerRelativeUrl Property

Gets or sets the server-relative URL for the website.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableAttribute> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotNull)> _
<ClientCallableConstraintAttribute(FixedId := "illegalchars", Type := ClientCallableConstraintType.Custom,  _
    Value := "It MUST NOT contain any of the following characters: ([~"#%&\*:<>?\\{|}\x7F])|(\.\.)|(//)|(^\.)|(\.$)|(^_)")> _
<ClientCallableConstraintAttribute(FixedId := "urlReserved", Type := ClientCallableConstraintType.Custom,  _
    Value := "It MUST NOT contain any of the reserved Urls.")> _
Public Property ServerRelativeUrl As String
    Get
    Set
'Usage
Dim instance As SPWeb
Dim value As String

value = instance.ServerRelativeUrl

instance.ServerRelativeUrl = value
[ClientCallableAttribute]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotNull)]
[ClientCallableConstraintAttribute(FixedId = "illegalchars", Type = ClientCallableConstraintType.Custom, 
    Value = "It MUST NOT contain any of the following characters: ([~"#%&\*:<>?\\{|}\x7F])|(\.\.)|(//)|(^\.)|(\.$)|(^_)")]
[ClientCallableConstraintAttribute(FixedId = "urlReserved", Type = ClientCallableConstraintType.Custom, 
    Value = "It MUST NOT contain any of the reserved Urls.")]
public string ServerRelativeUrl { get; set; }

Property Value

Type: System.String
A string that contains the server-relative URL.

See Also

Reference

SPWeb Class

SPWeb Members

Microsoft.SharePoint Namespace