PortalUrlCollection.Add Method
NOTE: This API is now obsolete.
Note The PortalUrl constructor throws an InvalidOperationException when you try to create a portal URL with a URL name that already exists. To avoid this issue, use a try/catch block around any PortalUrl constructors.
Namespace: Microsoft.SharePoint.Portal.Topology
Assembly: Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)
Syntax
'Declaration
<ObsoleteAttribute> _
Public Function Add ( _
portalUrl As PortalUrl _
) As PortalUrl
'Usage
Dim instance As PortalUrlCollection
Dim portalUrl As PortalUrl
Dim returnValue As PortalUrl
returnValue = instance.Add(portalUrl)
[ObsoleteAttribute]
public PortalUrl Add(
PortalUrl portalUrl
)
Parameters
- portalUrl
Type: Microsoft.SharePoint.Portal.Topology.PortalUrl
Return Value
Type: Microsoft.SharePoint.Portal.Topology.PortalUrl
Remarks
Sample of code that will be broken by this change:
TopologyManager tm = new TopologyManager();
url1 = new PortalUrl("http://widgets.microsoft.com", new Uri(“http://exampleURL”));
tm.PortalUrls.Add(url1);
url2 = new PortalUrl("http://widgets.microsoft.com", new Uri(“http:// exampleURL”)); //This throws System.InvalidOperationException
To work around this issue
Use a try/catch block around any PortalUrl constructors.