Sharepoint: How to find out whether an realtive URL is available or already used by a site -


How can I find out if a URL is available and to create a new site within the site collection or to make it already Is there any other site, list or library used?

Assuming that the relative URL "/ newUrl / is not yet in use, the code below will not actually throw an exception unless you have the properties of any SPWeb.

< Using pre> (SPS ite site = new site ("http: // portal /") {SPWeb web = site.OpenWeb ("/ newUrl /"); // No exception string title = web.Title ; // throws exception}

Of course this will be possible to check the achievement of this URL in such a way, but it will be more like a hack

Bye, Flo

Comments