I am using Office 365 package and using get list items to fetch ceratin list items. Output of this activity is datatable but I need to have this datatable as a dictionary array.
Datatable → Array of [dictionary(String,Object)]
getListItems → dict as shown in variable panel below:
Hi @sonaliaggarwal47,
Use below code dictArray= dt.AsEnumerable() _ .Select(Function(row) New Dictionary(Of String, Object) From { {row("Column1").ToString(), row("Column2")}}).ToArray()
I followed another approach of saving 1 row at a time into dictionary as datatable can have dynamic number of rows, and we could not find solution to initialize dictionary array on the go based on the number of rows in datatable.
If you use IEnumerable instead of Array, and initialize it as New List(of datatype) then the number of elements isn’t static like an array, you can add elements to it with .concat or with an assign = {val1, val2, val3, etc.}