Hi
I was able to retrieve all the web application names within a farm using object model. But I could not find a way to display all the web application URLs within a farm.
Can some one help me with this?
Thanks
Carol
Hi
I was able to retrieve all the web application names within a farm using object model. But I could not find a way to display all the web application URLs within a farm.
Can some one help me with this?
Thanks
Carol
The webapplication urls are bound to the Zones used by the webapplication (i.e. the Default, Internet and Intranet zones), find them using the SPWebApplication.AlternateUrls
property. (msdn)
I take it you probably really want all site collection URLs on all web applications. Here's a short powershell script I wrote - you should be able to infer the C# OM from this:
[reflection.assembly]::loadwithpartialname("microsoft.sharepoint") > $null
[Microsoft.SharePoint.Administration.SPFarm]::local.services | `
where-object {$_ -is [Microsoft.SharePoint.Administration.SPWebService] } | `
select -expand webapplications | select -expand sites | `
select url, zone, owner, rootweb | format-table -auto
Hope this helps,
-Oisin