web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Sort and delete non-existing Dataverse Items from Sharepoint List

(0) ShareShare
ReportReport
Posted on by 222

Hi.

 

I am looking to update a Sharepoint List with Dataverse Data using the Sharepoint Batch action in Power Automate.

 

I have no issues getting everything updated, and creating new items that are not already in Sharepoint is also working fine. However, I am having difficulties wrapping my head around deleting items from the Sharepoint Lists that are no longer in Dataverse.

 

My flow relating to the filtering etc. Currently looks like this, and was copied from a guide i found:

 

Gematria_1-1672733663945.png

 

And I would like to have a third branch that filters everything that is in the Sharepoint List, but not in the Dataverse anymore.

 

I was thinking about creating 2 arrays with unique Keycolumns from both the Sharepoint Data and the Dataverse Data, and then comparing the 2 to find out which of the items in the Sharepoint Data is no longer in the Dataverse data, but I am not sure how to achieve this without using some Apply To Each and compare the individual items.

 

Can anyone point me in the right direction here?

 

I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Sort and delete non-existing Dataverse Items from Sharepoint List

    You can collect all the IDs from your Dataverse Table then use a Filter array to identify the SharePoint List items that aren't part of your Dataverse Table.

     

    For this example, I'm using the following Dataverse Table.

    grantjenkins_0-1672795664910.png

     

    And the following SharePoint List. Note that I'm matching on Name to Title. You would likely have an actual ID.

    grantjenkins_1-1672795703119.png

     

    We can see that Test 004 and Test 007 exist in SharePoint but not Dataverse, so these are the ones that should be deleted from our SharePoint List.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_2-1672795871140.png

     

    List rows and Get items retrieves the items from Dataverse and SharePoint.

    grantjenkins_3-1672795915745.png

     

    Select extracts all the Name values into a simple array. Note that I'm using Text mode in the Select (see arrow on screenshot below).

    grantjenkins_4-1672795974628.png

     

    Filter array returns items from our SharePoint List where the Title doesn't exist within our array of Names. This will give us the items that exist in SharePoint, but not in Dataverse - the items we want to delete.

    grantjenkins_5-1672796050897.png

     

    Apply to each then iterates over each of the items we want to delete and uses Delete item to delete them. The expression to get the ID of the item we want to delete is below:

    items('Apply_to_each')?['ID']

    grantjenkins_6-1672796132552.png

     

    After running the flow, we can see the two items have been deleted.

    grantjenkins_7-1672796180789.png

     

  • Gematria Profile Picture
    222 on at
    Re: Sort and delete non-existing Dataverse Items from Sharepoint List

    Did not expect to get the solution handed to me like that 😄 Much appreciated!

    It was the whole filtering I couldn't quite wrap my head around, but makes sense when I see it now.

     

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 650 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 341 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard