public bool CreateDocumentLibray(string spsite, string DocLibName)
{
bool DocumentLibrayExist = false;
try
{
SPSite Site = new SPSite(spsite);
Site.AllowUnsafeUpdates = true;
SPWeb web = Site.OpenWeb();
SPListTemplateType tempType = SPListTemplateType.DocumentLibrary;
web.Lists.Add(DocLibName, null, tempType);
DocumentLibrayExist =true;
Site.AllowUnsafeUpdates = false;
}
catch (Exception ex)
{
throw ex;
}
return DocumentLibrayExist;
}
{
bool DocumentLibrayExist = false;
try
{
SPSite Site = new SPSite(spsite);
Site.AllowUnsafeUpdates = true;
SPWeb web = Site.OpenWeb();
SPListTemplateType tempType = SPListTemplateType.DocumentLibrary;
web.Lists.Add(DocLibName, null, tempType);
DocumentLibrayExist =true;
Site.AllowUnsafeUpdates = false;
}
catch (Exception ex)
{
throw ex;
}
return DocumentLibrayExist;
}
No comments:
Post a Comment