cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Omar
Advocate I
Advocate I

forms delete all responses

It would be great to have an action that when triggered deletes a response or possibly all responses. Due to GDPR having data saved both in Forms and in SharePoint (if the form data is copied into SharePoint) is not ideal and there is currently no way to automate the deletion of the responses from within Flow. I know all of the responses within a form can be deleted from within the Forms action menu so having something similiar as an action within Flow would be great.

1 ACCEPTED SOLUTION

Accepted Solutions
70 REPLIES 70
v-yamao-msft
Community Support
Community Support

Hi @Omar,

 

Are you working with SharePoint forms? Do you want to delete the items in the forms using Microsoft Flow?

 

If yes, I am afraid that currently there is no available action can be used. Please consider submitting a request on Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, @Omar!

 

If you have already posted your idea to the Flow Community Ideas Forum then you need to post the URL to your idea’s thread as a reply to this thread and then "Accept as Solution" on that reply so other users may vote for your Flow Idea and identify the information easily.

 

Thank You!

 

-Gabriel
Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager



Omar
Advocate I
Advocate I

Hi All,

Did anyone find how to deleted Microsoft Forms responses from excel using flow? 

WendyOx
New Member

This is not solved! The suggestion is just a request to Voice Ideas ... unmark as solved!

ewfefwef
Advocate II
Advocate II

Use Send HTTP Request to SharePoint Connector in Power Automate.

You need your TenantID, UserID and FormID(s).

See Azure Active Director or Powershell to get Tenant and UserIDs. The form URL shows the ID.

My flow deletes all responses from many forms each night.

I created a simple array FormID with Name & ID of all the forms. You could easily use a MS List or excel or whatever source you want to maintain for Form Name/IDs.

Loop the array and delete all responses.

You Parse the JSON (your array) inside the loop to be able to use the ID string variable in the HTTP connector. Makes it easy to read and understand the flow, I just prefer to an expression.

 

ewfefwef_0-1648103610484.png

 

Holy mother of all it does work your way !

the difference is i change

the Users/[Uservariable] for Groups/[GroupVariable]

 

using the sharepoint http request allows you to authenticate

 

Someone69_1-1650984685292.png

 

clh
Advocate I
Advocate I

The Send HTTP request solution has one problem, as mentioned in this Reddit post:

https://www.reddit.com/r/PowerPlatform/comments/111amhf/how_to_use_power_automate_to_delete_response...

 

It deletes ALL current responses in the form.

 

If the form gets used heavily where there's a high likelihood of multiple users submitting responses close together, or happens to submit something at the exact moment the flow runs to delete all responses, then some responses will get missed.

 

I discovered a way to delete THIS response, i.e., the specific individual response that's being handled by the current run instance of the Automate flow so that it doesn't impact other responses.  That is to add the Response Id in parentheses after the /responses part of the Uri.

To get the Response Id, use the trigger "When a new response is submitted" and Response Id is an output from that trigger.

 

clh_0-1676588825569.png

 

 

this did work until now, it returns with BadRequest 400 

{
  "status"400,
  "message""Unexpected response from the service\r\nclientRequestId: c9e203aa-61ee-4be6-9452-8041ab1dba8b",
  "error": {
    "message""Unexpected response from the service"
  },
  "source""sharepointonline-cc.azconn-cc-002.p.azurewebsites.net"
}

Still works for me.

Anonymous
Not applicable

I just wanted to follow (for future documentation purposes) that the API is picky, I got the above error when I used double quotes around the form_id, changing to using single quotes and the call works.

HI @clh as a newbie, i am trying to get this to work - but i simply have add to list steps, then the http request to delete the matching ID in the form. Using the raw ID's added into the api string for tenant, user and form with ('xxxx') wrapper, should this work> i get the error mentioned above

You'll need to provide more details about what you're trying to do, maybe a screen shot of your flow.  I don't understand what you're asking.

Hi @apacey ,

Did you find a solution to make your flow work?

I tried a variety of different symbols before and after the FormID part of the Uri, but no luck:

1. Parentheses:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms(@{variables('FormID')})/responses


2. Parentheses and single quote:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms('@{variables('FormID')}')/responses


3. Parentheses and double quote symbols:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms("@{variables('FormID')}")/responses


4. No additional symbols:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms@{variables('FormID')}/responses


5. slash between "forms" and the formID:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms/@{variables('FormID')}/responses


6. Slash and parentheses and single quite marks:

/formapi/api/@{variables('TenantID')}/users/@{variables('UserID')}/forms/('@{variables('FormID')}')/responses

 

demzem
Frequent Visitor

Hi @ptstockley 
I did fix this yes! I saw that the error related to authentication, so stripped it back and rebuilt it as the below.. works like a dream!

I need to go back and tidy the flow as i no longer need tenant id or user id variables... I like removing each form entry by ID with each iteration of the entire flow, just remove (Response ID) from the below to delete all.

/formapi/api/forms('⁠FormID×⁠')/responses(⁠Response Id×⁠)

demzem_1-1699518744441.png

 

demzem_0-1699518618307.png

 



Thank you for this! 🙂

In testing I think I noticed that the account running the flow, must have editing access to the form in order for the flow to succeed.

Perhaps this is obvious (to avoid deleting responses from non-owners), but i haven't seen it explicitly stated.

clh
Advocate I
Advocate I

I'm still not sure I entirely understand what these last few posts are trying to do but if you're hard coding the values instead of using variables, then it would look like this...

 

If...

  • tenantId = abc123-def456
  • userId = xyz789-ghf789
  • formId= qwerty345-mnop987
  • ResponseId = 7

then you get this for the Uri...

formapi/api/abc123-def456/users/xyz789-ghf789/forms('qwerty345-mnop987')/responses(7)

I.e., ...

  • tenantId, userId, and formId are just plain strings.
  • tentantId and userId are NOT surrounded by any quotes within the Uri (either single or double).
  • formId IS surrounded by SINGLE quotes (apostrophes) and the parenthesis in the Uri.
  • ResponseId is a numeric value and, again, is NOT surrounded by any quotes, just within parentheses.  But to really make this work you'll need to use the output of the trigger and I don't see why this would ever be hard coded anyway.

If you want to delete ALL responses, as the original post in this thread indicated, simply remove the parenthesis and ResponseId from the end.  I.e., ...

formapi/api/abc123/users/xyz789/forms('qwerty456')/responses

 

I guess one thing I didn't mention in my original post about deleting individual responses was where to actually get the ResponseId from.  Use the "When a new response is submitted" trigger and the ResponseId is an output from that trigger.  I've edited my previous post to include this.

 

And yes, the account that runs the flow must have permissions to the form.  That's true of ANYTHING in Power Automate, so yes, it's obvious and shouldn't need to be stated.  (E.g., a flow can't work with a SharePoint list if the account running the flow doesn't have access to the SharePoint list.)  In most cases, people are likely running the flow from the same account that hosts the form.  If the flow is running in a different account, then yes, that account must be granted permissions to the form.

 

 

demzem
Frequent Visitor

Hi @clh for the reply, so the problem was that the tenant id and user id caused errors.
So basically I removed them and it now works brilliantly! 🙂
Not sure why they would be needed in some environments and not others , but I guess we will find out when they stop working 😞

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages