다음을 통해 공유


SPSite.PortalUrl Property

Gets or sets the URL to a portal. (Read-only in sandboxed solutions.)

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

Syntax

'Declaration
Public Property PortalUrl As String
    Get
    Set
'Usage
Dim instance As SPSite
Dim value As String

value = instance.PortalUrl

instance.PortalUrl = value
public string PortalUrl { get; set; }

Property Value

Type: System.String
A string that contains a URL ending with a forward slash ("/"), as in "http://Portal_Name/".

Remarks

The PortalUrl property must be set together with the PortalName property in order to establish a connection to a portal site. The PortalUrl property must be specified first and the PortalName property second.

Examples

The following code example uses the PortalUrl property to establish a connection to a portal site from the specified site collection.

Using oSiteCollection As New SPSite("http://Server_Name/sites/Site_Name")
    oSiteCollection.PortalUrl = "http://Portal_Site/"
    oSiteCollection.PortalName = "Portal_Name"
End Using
using (SPSite oSiteCollection = new SPSite("http://Server_Name/sites/Site_Name"))
{
    oSiteCollection.PortalUrl = "http://Portal_Site/";
    oSiteCollection.PortalName = "Portal_Name";
}

Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

See Also

Reference

SPSite Class

SPSite Members

Microsoft.SharePoint Namespace