AddList
Creates a new SharePoint list with specified properties. Helps automate the setup of structured data storage.
Stored Procedure-Specific Information
The AddList stored procedure creates a new list in SharePoint. You can specify the list name, template type, description, and optionally define columns to create with the list.To create a basic list, enter:
EXEC AddList Name = 'Test List', Template = 'GenericList', Description = 'A test list';
To create a list with predefined columns, you can use a JSON aggregate or a temporary table for the Columns parameter:
EXEC AddList Name = 'Test List', Template = 'GenericList', Description = 'A test list with columns', Columns = '[{"ColumnName":"Column1","ColumnType":"Text"},{"ColumnName":"Column2","ColumnType":"Number"}]';
Using a temporary table for columns:
INSERT INTO Columns#TEMP (ColumnName, ColumnType) VALUES ('TestColumn', 'Text');
EXEC AddList Name = 'Testing', Template = 'GenericList', Description = 'Desc', Columns = 'Columns#TEMP';
Input
| Name | Type | Required | Description |
| Name | String | True | The name of the new list to be created on the SharePoint server. |
| Template | String | True | The name or ID of the template to use when creating the list (such as 'Custom List' or 'Document Library').
The allowed values are GenericList, DocumentLibrary, Survey, Links, Announcements, Contacts, Events, Tasks, DiscussionBoard, PictureLibrary, DataSources, WebTemplateCatalog, UserInformation, WebPartCatalog, ListTemplateCatalog, XMLForm, MasterPageCatalog, NoCodeWorkflows, WorkflowProcess, WebPageLibrary, CustomGrid, DataConnectionLibrary, WorkflowHistory, GanttTasks, Meetings, Agenda, MeetingUser, Decision, MeetingObjective, TextBox, ThingsToBring, HomePageLibrary, Posts, Comments, Categories, IssueTracking, AdminTasks. The default value is GenericList. |
| Description | String | False | A brief description of the list to provide context about its purpose. |
| Columns | String | False | The definition of the columns to be added to the list. Accepts JSON, XML, or a temporary table format. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the list creation was successful. Returns 'true' for success and 'false' for failure. |