Forum Discussion
MS Forms API implementation
I have tried to implement your solution but it does not work.
It does not delete the response.
lhaydee just saying it doesn't work with no other information doesn't really help us to help you. Could you give a screenshot of your flow?
- lhaydeeFeb 20, 2023Copper Contributor
RobElliott Hi Rob:
The flow looks like this:
First action search the user id
Second compose tenant id
Third, Forms id
Four, Http request
- samb2180Mar 24, 2023Brass Contributor
Well, just in case you are still interested in how to delete responses from an specific user, here is an approach that I tried and it's working for me.
First of all, you need to understand the structure of the Forms API.https://forms.office.com/formapi/api/[TenantID]/users/[UserID]/forms('[FormID]')/responses
[TenantID] - no doubts about it, tenant ID where the form is hosted.
[UserID] - is the UserID of the Form owner.
[FormID] - no doubts about this.
If you try this API and take a look to the JSON, you will see each response has an ID.
To delete a single ID, you just need to use the delete method specifying the response ID.https://forms.office.com/formapi/api/[TenantID]/users/[UserID]/forms('[FormID]')/responses([ResponseID])
But if you need to delete all responses from specific user, you may use the first API call to collect all responses, parse the JSON, filter the array by responder property. Just note the responder property uses the responder UPN, not the email.
Now you have an array with the responder UPN and the response ID, just use an apply to each loop to delete each response.- jimbanach-msftSep 19, 2024
Microsoft
is this still working for you. I've had this working for a few weeks now and all of a sudden querying for individual responses seems to not respond.
Trying to find out if it is just me or something larger going on.
- samb2180Mar 23, 2023Brass ContributorNot sure what do you want to achieve... Do you want to delete all answers from an specific user in a single Form?
- RobElliottFeb 20, 2023Silver Contributor
lhaydee But you're trying to do something different to what the original post and my solution was about. My solution deleted all responses in the spreadsheet behind the form. It looks like you want to delete the responses from a specific responder. I don't know if this is possible, I've never done it, so someone else might have to give you a solution here.
- lhaydeeFeb 21, 2023Copper Contributor
RobElliott Misunderstood the reply. Sorry!
I thought your flow idea allowed to force the deleting of the response.
In my opinion, this field, Forms365, needs to expand on PowerAutomate because there is little info, action and conectors available limiting the possibilities to implement flows.
Anyway, thanks a lot for your response and time.
Leticia