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 [Dynamic Column]@odata\u002Etype must be set as Collection(Edm.String)
[Dynamic Column]LookupId DT_I4 int [Dynamic Column] Id
[Dynamic Column]LookupIdOdataType DT_WSTR nvarchar(100) 100 [Dynamic Column]@odata\u002Etype must be set as Collection(Edm.Int32)
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
SharePoint Connector can be used to read, write data in SharePoint Online List / Document Library, perform file operations such as upload, download, create, move, delete, rename in a few clicks!
SharePoint Online
[Dynamic Table]
Insert
Required Parameters
ListId Fill-in the parameter...
Optional Parameters
SiteId (Re-Select ListId after you change this)
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Create list item (SharePoint Document Library)

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.

Insert data into a named list

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

Insert multiple Lookup or Person/Group IDs into a named list

--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

Insert multiple Choice Values into a named list

--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 list item (SharePoint Document Library)

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];

Insert data into a named list

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

EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];

Insert multiple Lookup or Person/Group IDs into a named list

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];

Insert multiple Choice Values into a named list

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).