public bool CheckContentType(string spsite, string contenttypename)
{
bool ContentTypeFound = false;
try
{
SPSite a = new SPSite(spsite);
SPWeb web = a.OpenWeb();
SPContentType myContentType = web.ContentTypes[contenttypename];
if (myContentType != null)
{
//found
ContentTypeFound = true;
}
else
{
//Not found
ContentTypeFound = false;
}
}
catch (Exception ex)
{
throw ex;
}
return ContentTypeFound;
}
{
bool ContentTypeFound = false;
try
{
SPSite a = new SPSite(spsite);
SPWeb web = a.OpenWeb();
SPContentType myContentType = web.ContentTypes[contenttypename];
if (myContentType != null)
{
//found
ContentTypeFound = true;
}
else
{
//Not found
ContentTypeFound = false;
}
}
catch (Exception ex)
{
throw ex;
}
return ContentTypeFound;
}
No comments:
Post a Comment