cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Writing sharepoint list using array variable

Hello!

I've created a flow to get the tasks from a Planner plan and write them in a sharepoint list. I'm doing this with multiple plans, and for each plan I generate a sharepoint list.

What I want to do now is to merge all of these separate sharepoint lists in another (already existing) list. I think it is possible by appending the items from each plan in one array variable, and then pass this variable into a sharepoint list, as mentioned in this post.

How would I do that, though? I tried a lot of things but always ended up with some errors.


What I have:

BabyShark_0-1619025950286.png

 

What I want:

asdads.png

 

Edit: forgot to attach hyperlink. 

2 REPLIES 2
DamoBird365
Microsoft
Microsoft

Hey @Anonymous doo doo do do do do

 

Big assumption but if the lists are all the same, you can use the expression UNION to combine the value array from get lists and then parse the new array so that the content can be used dynamically.  You can generate a payload for a union by running the flow and copying the history from the output of the union.  You can then load the result of the union into an apply to each and create an item for each of the items into your new list.  I have done this with 2 lists, union'd them and then written the array back to a new list.

 

HowToCopyPasteSolution.gif

 

{"id":"c2817437-5d53-471d-ae0e-0b1d-e750fc73","brandColor":"#8C3900","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/shared-sharepointonl-c5e113e4-3432-4cf0-bcc3-e1f7a72a25cb"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365_Append_Lists","operationDefinition":{"type":"Scope","actions":{"Get_items":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"https://abdndamodev.sharepoint.com/sites/DamoBird365","table":"adb8e4b4-a65d-433e-919c-2e4dbd81b437","$top":10},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{}},"Get_items_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"GetItems","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"https://abdndamodev.sharepoint.com/sites/DamoBird365","table":"5563ba52-3eb1-4711-84f5-1d3c44840767","$top":10},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Get_items":["Succeeded"]}},"Union":{"type":"Compose","inputs":"@union(outputs('Get_items')?['body/value'],outputs('Get_items_2')?['body/value'])","runAfter":{"Get_items_2":["Succeeded"]}},"Parse_JSON":{"type":"ParseJson","inputs":{"content":"@outputs('Union')","schema":{"type":"array","items":{"type":"object","properties":{"@@odata.etag":{"type":"string"},"ItemInternalId":{"type":"string"},"ID":{"type":"integer"},"Title":{"type":"string"},"Description":{"type":"string"},"Status":{"type":"object","properties":{"@@odata.type":{"type":"string"},"Id":{"type":"integer"},"Value":{"type":"string"}}},"Status#Id":{"type":"integer"},"DaysOld":{"type":"string"},"Modified":{"type":"string"},"Created":{"type":"string"},"Author":{"type":"object","properties":{"@@odata.type":{"type":"string"},"Claims":{"type":"string"},"DisplayName":{"type":"string"},"Email":{"type":"string"},"Picture":{"type":"string"},"Department":{},"JobTitle":{}}},"Author#Claims":{"type":"string"},"Editor":{"type":"object","properties":{"@@odata.type":{"type":"string"},"Claims":{"type":"string"},"DisplayName":{"type":"string"},"Email":{"type":"string"},"Picture":{"type":"string"},"Department":{},"JobTitle":{}}},"Editor#Claims":{"type":"string"},"{Identifier}":{"type":"string"},"{IsFolder}":{"type":"boolean"},"{Thumbnail}":{"type":"object","properties":{"Large":{},"Medium":{},"Small":{}}},"{Link}":{"type":"string"},"{Name}":{"type":"string"},"{FilenameWithExtension}":{"type":"string"},"{Path}":{"type":"string"},"{FullPath}":{"type":"string"},"{HasAttachments}":{"type":"boolean"},"{VersionNumber}":{"type":"string"}},"required":["@@odata.etag","ItemInternalId","ID","Title","Description","Status","Status#Id","DaysOld","Modified","Created","Author","Author#Claims","Editor","Editor#Claims","{Identifier}","{IsFolder}","{Thumbnail}","{Link}","{Name}","{FilenameWithExtension}","{Path}","{FullPath}","{HasAttachments}","{VersionNumber}"]}}},"runAfter":{"Union":["Succeeded"]}},"Apply_to_each":{"type":"Foreach","foreach":"@body('Parse_JSON')","actions":{"Create_item_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"PostItem","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"https://abdndamodev.sharepoint.com/sites/DamoBird365","table":"94b7a53c-1631-4272-9cfd-7636ac00c624","item/Title":"@items('Apply_to_each')['Title']","item/Description":"@items('Apply_to_each')['Description']","item/Status/Value":"New"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{}}},"runAfter":{"Parse_JSON":["Succeeded"]}}},"runAfter":{}}}

 

If you copy the above code and paste it into the clip board of your cloud flow -> new action -> clipboard,  you can use the prebuilt demo, albeit it relies on my paths and lists but you will get to see the actions etc required in your environment immediately.

 

If you want to see what it looks like otherwise, here are some screenshots:

 

DamoBird365_0-1619037879177.png

 

DamoBird365_1-1619037908318.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Anonymous
Not applicable

Thank you for your time and effort, this really helped me a ton.

When I was implementing the changes, I figured a easier way to solve my problem. Check it out:

 

BabyShark_0-1619096360300.png

 

Your suggestion was definitively gonna work, though. Kudos for you!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,711)