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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need help with impleme...
Power Automate
Answered

Need help with implementing delete feature in Power Automate flow for SharePoint list and distributed group

(0) ShareShare
ReportReport
Posted on by 173

I have a distributed group that contains many users. Additionally, I have a SharePoint list with two columns called Name and Email, which retrieves all users from the distributed group and stores them in the SharePoint list using Power Automate. However, I want to automatically delete users from the SharePoint list whenever they are deleted from the distributed group. I have already designed a flow that is working perfectly, but I don't understand how to implement the delete feature. Can you please help me?

 

rswain_0-1681899476810.png

rswain_1-1681899563061.png

 

Categories:
I have the same question (0)
  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @rswain ,

     

    I think you can add below logic to your flow after the "apply to each 2" action. Your create item part is perfect and for deleting the item, you need to compare each item in SP list with each item in group members, and if the result is no, then it means the current item in SP list is actually deleted in Azure ad group, and you need to delete this item.

     

    HenWang_0-1681958487240.png

    For the get items 2 action, please do not use any filter query so that flow can loop each item inside the list.

     

    For the condition 2 action, I used the title dynamic content which contains the email address value, you can also compare the name value from your side.

     

    Hope this can help.

     

    Best Regards,

    Hen Wang

  • rswain Profile Picture
    173 on at

    Hi @HenWang ,

    Thanks for your time. 
    I have tried the same but I am getting error during flow execution.

    rswain_1-1681968494813.png

     

    rswain_0-1681968371917.png

     

  • rswain Profile Picture
    173 on at

    Even its deleting my all records in the list 

  • HenWang Profile Picture
    Microsoft Employee on at

    I think there is something wrong in delete item action, can you show me the screenshot of the delete item action details?

  • rswain Profile Picture
    173 on at

    rswain_0-1681970649793.png

     

  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @rswain ,

     

    Truely sorry for that. Please refer to below logic:

    HenWang_0-1681977613448.png

     

     

    And then, please refer to this :

    HenWang_1-1681977678712.png

     

    Formula inside the condition control:

    length(variables('If_No'))                                                                       //left

    length(outputs('Get_group_members')?['body/value'])                        //right

     

    This logic would help to complete your flow.

     

    Best Regards,

    Hen Wang

  • rswain Profile Picture
    173 on at

    rswain_0-1681985344864.png

    rswain_1-1681985390856.png

    rswain_2-1681985654212.png

    rswain_3-1681985667734.png

     

     

    I have updated the same logic. However, the flow is now working successfully, but the user is unable to delete from the SharePoint list.

     

  • rswain Profile Picture
    173 on at

    @HenWang  Any chance to look into this ?

  • Verified answer
    HenWang Profile Picture
    Microsoft Employee on at

    Hi @rswain ,

     

    Yes, there are two places to improve:

    1. empty the string variable VerifyUsers after your condition 3 action:

    HenWang_0-1682064321821.png

     

    Just set it to null formula. 

     

    2. If the result is still not correct, you can consider using toLower formula to both of the email address in your condition action:

    HenWang_1-1682064431084.png

    For example, I will use below formula for the group mail dynamic content:

    toLower(items('Apply_to_each_2')?['mail'])

     

    which would be  toLower(items('Apply_to_each_3')?['mail'])   in your flow.

     

    Hope this helps.

     

    Best Regards,

    Hen Wang

  • rswain Profile Picture
    173 on at

    It's now working like a charm Thanks for your time .

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard