Hi,
This is my code which checks if a SharePoint site exists or not.
string URL = Console.ReadLine();
using (SPSite objSite = new SPSite(URL))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
Console.WriteLine(string.Format("Site Exists: {0}", objWeb.Exists.ToString()));
}
}
However, it doesn't seem to work. The "Exists" property always returns true even if the site/subsite does not exists. I get the same result when the URL is either "http://intranet" or "http://intranet/sitedoesnotexists".
Am I using this in the correct way?
Thanks
Edit
Sorry about the formatting, I was sure that I applied it but I guess I forgot.