public bool SiteExists(string url)
{
bool Exists = false;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.OpenWeb(url, true))
{
Exists= true;
}
}
});
}
catch (FileNotFoundException)
{
Exists= false;
}
return Exists;
}
{
bool Exists = false;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.OpenWeb(url, true))
{
Exists= true;
}
}
});
}
catch (FileNotFoundException)
{
Exists= false;
}
return Exists;
}
No comments:
Post a Comment