Add new Item to SharePoint list using data from datatable

Hi All,

I want to add data from datatable using Microsoft O365 activities.
I did the below steps but the values are not being written in SharePoint
1- Use Microsoft Office 365 Scope -SharePoint(using Application Id & Tenant Id)
2- Get List Info-SharePoint Data
3- For Each List Item-SharePoint data
4- Do While(condition = i< ListItem.Fields.Count ; i intialized to 0)
4.1- Switch Case 1- id = ListItem.Fields(i).Value.ToString
4.2 - Add Data Row (using array row and datatable)
4.3 - i=i+1
5-Add List Items (using List & Multiple List Item)

Could someone please help on this?

Hi,

Can you share your workflow and content of the datatable which input as List item?

Regards,

@Yoichi
PFA
InsertErrorEntrySharePoint.xaml (36.7 KB)
Due to client specific data i have removed sharepoint url, application id & tenant id

Hi,

Official document says

Multiple List Items - The field values for multiple list items. The first row represents the column headers (fields names). The remaining rows represent the field values, each row corresponding to a list item. This field supports only DataTable variables.

So, we need to set field names not in column header but in the first row (row #0).
Can you try to modify your datatable as the following?

image

Regardsi

@Yoichi
Tried and getting the below error,

@Yoichi
As datatable data is
image
+

Hi,

The error says field “Schedule Agreement Number” doesn’t exist.
Can you check if the field names are correct using the following expression?

String.Join(",",SharePointList.Columns.Select(function(c) c.Name))

and

String.Join(",",SharePointList.Columns.Select(function(c) c.DisplayName))

The former shows column name and the latter shows display name.
(And we probably need to use former name)

Regards,

@Yoichi
In column name, i get below
“ID,ContentType,Title,Modified,Created,Author,Editor,_UIVersionString,Attachments,Edit,LinkTitleNoMenu,LinkTitle,DocIcon,ItemChildCount,FolderChildCount,_ComplianceFlags,_ComplianceTag,_ComplianceTagWrittenTime,_ComplianceTagUserId,AppAuthor,AppEditor,ComplianceAssetId,ScheduleAgreementLine,DSLID,Reference,Deliverydate,Quantity,Action_x0028_Insert_x002f_Update,Status,Comments,ProcessedAt,CPSequenceNumber,_IsRecord”

In display name , i get below
“ID,Content Type,Title,Modified,Created,Created By,Modified By,Version,Attachments,Edit,Title,Schedule Agreement Number,Type,Item Child Count,Folder Child Count,Label setting,Retention label,Retention label Applied,Label applied by,App Created By,App Modified By,Compliance Asset Id,Schedule Agreement Line,DSL ID,Reference,Delivery date,Quantity,Action(Insert / Update),Status,Comments,Processed At,CP Sequence Number,Item is a Record”

In column name, i dont find Schedule agreement number

Hi,

Where did you get “Schedule Agreement Numbe” from?

Perhaps you should create datatable using BuildDataTable from the above column name as the first row.
Then fill data into the datatable and add it to Sharpoint List using AddListItem activity.

Regards,

I am able to see in my SharePoint as a column name “Schedule Agreement number” in SharePoint

Hi,

Probably it’s display name. The actual name seems “LinkTitle”. For now, can you try this name instead of “Schedule Agreement Number”

Same issue,

Hi,

To isolate cause, can you try to add simple item which has just Title as the following?

for Multiple List items property

image

OR

for Single List Item property

image

Regards,

@Yoichi
I tried this
image

Along with this,

It dint throw any error neither did it write to the SharePoint

Hi,

It seems strange… Did you check it by not list-view but actual list?

Regards,

I have downgraded office 365 package vision to 1.11.1 and it is working as expected.

I am still getting the same error you got, even after downgrading Office 365 to 1.11.1

I’m also getting this error message… Did you find a solution yet?

1 Like