Reference

Endpoint Create List Item


Name

create_list_item

Description

No description available

Related Tables

[Dynamic Table] , ListItems

Parameters

Parameter Required Options
Name: ListId

Label: ListId

Specify a list id to search items for
YES
Name: SiteId

Label: SiteId (Re-Select ListId after you change this)

Specify a site

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
Id DT_WSTR nvarchar(200) 200
CreatedOn DT_DBTIMESTAMP datetime
CreatedById DT_GUID uniqueidentifier
CreatedByDisplayName DT_WSTR nvarchar(200) 200
ModifiedOn DT_DBTIMESTAMP datetime
LastModifiedId DT_GUID uniqueidentifier
LastModifiedDisplayName DT_WSTR nvarchar(200) 200
[Dynamic Column] DT_WSTR nvarchar(2000) 2000 [Dynamic Column]
If the column you are looking for is missing, consider customizing SharePoint Online Connector.

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
[Dynamic Column] DT_WSTR nvarchar(2000) 2000 [Dynamic Column]
[Dynamic Column]OdataType DT_WSTR nvarchar(100) 100 If you map [Dynamic Column] field then you must map this field and pass static value Collection(Edm.String) for [Dynamic Column]OdataType
[Dynamic Column]LookupId DT_I4 int [Dynamic Column] Id
[Dynamic Column]LookupIdOdataType DT_WSTR nvarchar(100) 100 If you map [Dynamic Column]LookupId field then you must map this field and pass static value Collection(Edm.Int32) for [Dynamic Column]LookupIdOdataType
Required columns that you need to supply are bolded.

Examples

SSIS

Use SharePoint Online Connector in API Source or in API Destination SSIS Data Flow components to read or write data.

API Destination

This Endpoint belongs to the [Dynamic Table] table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to create list item:

API Destination - SharePoint Online
Read and write SharePoint Online data effortlessly. Integrate, manage, and automate sites, lists, document libraries, and files — almost no coding required.
SharePoint Online
[Dynamic Table]
Insert
Required Parameters
ListId Fill-in the parameter...
Optional Parameters
SiteId (Re-Select ListId after you change this)
Format for DateTime (Treat as Local or UTC) yyyy-MM-ddTHH:mm:ss.fffZ
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Create a document library item

<p>Creates a new item (metadata) in a document library list.</p>

INSERT INTO create_list_item(Title, OrderId)
VALUES ('My super title', 12345)
WITH (
	ListId='14bdfd1d-1090-4cfe-adc1-XXXXXXXXXXXXXX'
    ,Output=1
	)
--You can get ListId by selecting from 'list_lists' endpoint.

Create a list item

<p>Creates a new item in a list. Replace <code>MyList</code> with your list name and specify the columns to populate.</p>

INSERT INTO MyList(Name, Surname)
VALUES ('John', 'Doe') WITH (Output=1)

Create a list item with multi-select lookup or person fields

<p>Creates a list item with multi-select Lookup or Person/Group fields. Requires passing values as a JSON array and specifying the OData type (e.g. <code>Collection(Edm.Int32)</code>).</p>

--new version --				
INSERT INTO MyList(Title, ManyPersonsLookupId, ManyPersonsLookupIdOdataType)
VALUES ('John Doe', '[11,22,33]', 'Collection(Edm.Int32)')
WITH (Output=1)

--old version --				
INSERT INTO MyList(Title, ManyPersonsLookupId, "fields.ManyPersonsLookupId@odata\u002Etype")
VALUES ('John Doe', '[11,22,33]', 'Collection(Edm.Int32)')
WITH (Output=1)
--Considering "ManyPersons" is the name of the field in SharePoint List

Create a list item with multi-select choice fields

<p>Creates a list item with multi-select Choice fields. Requires passing values as a JSON array and specifying the OData type (e.g. <code>Collection(Edm.String)</code>).</p>

--new version --				
INSERT INTO MyList(Title, MultiChoiceField, MultiChoiceFieldODataType)
VALUES ('John Doe', '["Choice1","Choice5"]', 'Collection(Edm.String)')
WITH (Output=1)

--old version --				

INSERT INTO MyList(Title, MultiChoiceField, "fields.MultiChoiceField@odata\u002Etype")
VALUES ('John Doe', '["Choice1","Choice5"]', 'Collection(Edm.String)')
WITH (Output=1)

--Considering "MultiChoiceField" is the name of the field in SharePoint List

Update / Insert Sharepoint List Data (Mixed Data Types - e.g. Multi Choice, Lookup, Person, DateTime, Number)

UPDATE  "Travel Requests" --list name
SET   
	 Title='MyTitle @ <<FUN_NOW>>'  
	 --Method#1 Pass Value and Type in 2 fields
	, CustomText = 'This is text'
	, CustomTextLarge = 'This is really long text ....'	                     
	, CustomNumber = 10000.12345
	, CustomDateTime ='2012-12-31T23:59:59.123Z' --End with Z to treat as UTC time (avoid local-UTC conversion)
	, CustomChoice = 'BB'
	
	--Choice Multi-Select
	, CustomChoiceMulti = '["AA", "BB"]'
	, CustomChoiceMultiODataType='Collection(Edm.String)' --for multi select must supply OData Type 
	--OR-- append like below in one field
	--, CustomChoiceMulti = '["AA", "BB"], "CustomChoiceMulti@odata.type" : "Collection(Edm.String)"'
	
	--Lookup
	--field with Lookup type must be set to [<field-name>LookupId] field (suffix with LookupId)
	, CustomLookupSingleLookupId = 1 
	
	--Lookup Multi-Select
	, CustomLookupMultiLookupId = '[1,3]' --for multi select must supply OData Type 
	, CustomLookupMultiLookupIdODataType='Collection(Edm.Int32)'
	--OR-- append like below in one field
	--, CustomLookupMultiLookupId = '[1,3], "CustomLookupMultiLookupId@odata.type" : "Collection(Edm.String)"'
	
	--Person 
	,CustomPersonLookupId = 11  
	
	--Person Multi-Select
	, CustomPersonMultiLookupId = '[11, 22]' 
	, CustomPersonMultiLookupIdODataType='Collection(Edm.Int32)'
	--OR-- append like below in one field
	--, CustomPersonMultiLookupIdODataType = '[11,22], "CustomPersonMultiLookupIdODataType@odata.type" : "Collection(Edm.Int32)"'
	
Where Id=1 --List Item Id

--- Insert Example ----

INSERT INTO "Travel Requests" --list name
(
	 Title
	, CustomText 
	, CustomTextLarge 
	, CustomNumber 
	, CustomDateTime 
	, CustomChoice 
	
	, CustomChoiceMulti 
	, CustomChoiceMultiODataType

	, CustomLookupSingleLookupId 
	
	--Lookup Multi-Select
	, CustomLookupMultiLookupId 
	, CustomLookupMultiLookupIdODataType
	
	--Person 
	,CustomPersonLookupId 
	
	, CustomPersonMultiLookupId 
	, CustomPersonMultiLookupIdODataType
)
VALUES(
	  'MyTitle @ <<FUN_NOW>>'  
	, 'This is text'
	, 'This is really long text .. '	                     
	, 10000.12345
	, '2012-12-31T23:59:59.123Z' --End with Z to treat as UTC time (avoid local-UTC conversion)
	, 'BB'

	--Choice Multi-Select
	, '["AA", "BB"]'
	, 'Collection(Edm.String)' --for multi select must supply OData Type 
	
	--Lookup
	,  1 
	
	--Lookup Multi-Select
	, '[1,3]' --for multi select must supply OData Type 
	, 'Collection(Edm.Int32)'
	
	--Person 
	,11  
	
	--Person Multi-Select
	, '[11, 22]' 
	, 'Collection(Edm.Int32)'
)

create_list_item endpoint belongs to [Dynamic Table] , ListItems table(s), and can therefore be used via those table(s).

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Create a document library item

<p>Creates a new item (metadata) in a document library list.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO create_list_item(Title, OrderId)
VALUES (''My super title'', 12345)
WITH (
	ListId=''14bdfd1d-1090-4cfe-adc1-XXXXXXXXXXXXXX''
    ,Output=1
	)
--You can get ListId by selecting from ''list_lists'' endpoint.';

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

Create a list item

<p>Creates a new item in a list. Replace <code>MyList</code> with your list name and specify the columns to populate.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO MyList(Name, Surname)
VALUES (''John'', ''Doe'') WITH (Output=1)';

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

Create a list item with multi-select lookup or person fields

<p>Creates a list item with multi-select Lookup or Person/Group fields. Requires passing values as a JSON array and specifying the OData type (e.g. <code>Collection(Edm.Int32)</code>).</p>

DECLARE @MyQuery NVARCHAR(MAX) = '--new version --				
INSERT INTO MyList(Title, ManyPersonsLookupId, ManyPersonsLookupIdOdataType)
VALUES (''John Doe'', ''[11,22,33]'', ''Collection(Edm.Int32)'')
WITH (Output=1)

--old version --				
INSERT INTO MyList(Title, ManyPersonsLookupId, "fields.ManyPersonsLookupId@odata\u002Etype")
VALUES (''John Doe'', ''[11,22,33]'', ''Collection(Edm.Int32)'')
WITH (Output=1)
--Considering "ManyPersons" is the name of the field in SharePoint List';

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

Create a list item with multi-select choice fields

<p>Creates a list item with multi-select Choice fields. Requires passing values as a JSON array and specifying the OData type (e.g. <code>Collection(Edm.String)</code>).</p>

DECLARE @MyQuery NVARCHAR(MAX) = '--new version --				
INSERT INTO MyList(Title, MultiChoiceField, MultiChoiceFieldODataType)
VALUES (''John Doe'', ''["Choice1","Choice5"]'', ''Collection(Edm.String)'')
WITH (Output=1)

--old version --				

INSERT INTO MyList(Title, MultiChoiceField, "fields.MultiChoiceField@odata\u002Etype")
VALUES (''John Doe'', ''["Choice1","Choice5"]'', ''Collection(Edm.String)'')
WITH (Output=1)

--Considering "MultiChoiceField" is the name of the field in SharePoint List';

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

Update / Insert Sharepoint List Data (Mixed Data Types - e.g. Multi Choice, Lookup, Person, DateTime, Number)

DECLARE @MyQuery NVARCHAR(MAX) = 'UPDATE  "Travel Requests" --list name
SET   
	 Title=''MyTitle @ <<FUN_NOW>>''  
	 --Method#1 Pass Value and Type in 2 fields
	, CustomText = ''This is text''
	, CustomTextLarge = ''This is really long text ....''	                     
	, CustomNumber = 10000.12345
	, CustomDateTime =''2012-12-31T23:59:59.123Z'' --End with Z to treat as UTC time (avoid local-UTC conversion)
	, CustomChoice = ''BB''
	
	--Choice Multi-Select
	, CustomChoiceMulti = ''["AA", "BB"]''
	, CustomChoiceMultiODataType=''Collection(Edm.String)'' --for multi select must supply OData Type 
	--OR-- append like below in one field
	--, CustomChoiceMulti = ''["AA", "BB"], "CustomChoiceMulti@odata.type" : "Collection(Edm.String)"''
	
	--Lookup
	--field with Lookup type must be set to [<field-name>LookupId] field (suffix with LookupId)
	, CustomLookupSingleLookupId = 1 
	
	--Lookup Multi-Select
	, CustomLookupMultiLookupId = ''[1,3]'' --for multi select must supply OData Type 
	, CustomLookupMultiLookupIdODataType=''Collection(Edm.Int32)''
	--OR-- append like below in one field
	--, CustomLookupMultiLookupId = ''[1,3], "CustomLookupMultiLookupId@odata.type" : "Collection(Edm.String)"''
	
	--Person 
	,CustomPersonLookupId = 11  
	
	--Person Multi-Select
	, CustomPersonMultiLookupId = ''[11, 22]'' 
	, CustomPersonMultiLookupIdODataType=''Collection(Edm.Int32)''
	--OR-- append like below in one field
	--, CustomPersonMultiLookupIdODataType = ''[11,22], "CustomPersonMultiLookupIdODataType@odata.type" : "Collection(Edm.Int32)"''
	
Where Id=1 --List Item Id

--- Insert Example ----

INSERT INTO "Travel Requests" --list name
(
	 Title
	, CustomText 
	, CustomTextLarge 
	, CustomNumber 
	, CustomDateTime 
	, CustomChoice 
	
	, CustomChoiceMulti 
	, CustomChoiceMultiODataType

	, CustomLookupSingleLookupId 
	
	--Lookup Multi-Select
	, CustomLookupMultiLookupId 
	, CustomLookupMultiLookupIdODataType
	
	--Person 
	,CustomPersonLookupId 
	
	, CustomPersonMultiLookupId 
	, CustomPersonMultiLookupIdODataType
)
VALUES(
	  ''MyTitle @ <<FUN_NOW>>''  
	, ''This is text''
	, ''This is really long text .. ''	                     
	, 10000.12345
	, ''2012-12-31T23:59:59.123Z'' --End with Z to treat as UTC time (avoid local-UTC conversion)
	, ''BB''

	--Choice Multi-Select
	, ''["AA", "BB"]''
	, ''Collection(Edm.String)'' --for multi select must supply OData Type 
	
	--Lookup
	,  1 
	
	--Lookup Multi-Select
	, ''[1,3]'' --for multi select must supply OData Type 
	, ''Collection(Edm.Int32)''
	
	--Person 
	,11  
	
	--Person Multi-Select
	, ''[11, 22]'' 
	, ''Collection(Edm.Int32)''
)';

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

create_list_item endpoint belongs to [Dynamic Table] , ListItems table(s), and can therefore be used via those table(s).