The following code snippet can be used to create a list in sharepoint site. The following example I have illustrated only DocumentLibrary creation.
public static bool CreateSPList(SPWeb web, string listName, SPListTemplateType type)
{
bool create = false;
try
{
if (type == SPListTemplateType.DocumentLibrary)
{
web.Lists.Add(listName, listName, SPListTemplateType.DocumentLibrary);
return true;
}
}
catch (Exception ex)
{
return false;
}
return create;
}
Vinay Chavadi's Blog on Application Development in SharePoint 2010/2013/2016 & SharePoint Online
Subscribe to:
Post Comments (Atom)
-
There are 3 SPJobLockType available: 1. SPJobLockType.None -- if you set it none, the instance will run in all the available s...
-
Most of you who are working on Remote Event Receivers must have encountered this issue of "Updated event getting fired multiple times&...
No comments:
Post a Comment