It is technically possible to disable a Microsoft Form from Power Automate. Why would you want to do this? Maybe it’s time limited – ok sure you can specify an end date via the existing UI. But what if that date or time was to be dynamic?
What if you wanted to turn off the form based on the number of submissions? My use case is based on users signing up to an event. We have 10 spaces, an 11th users tries to sign up. Wouldn’t it be nice if we could automatically disable the form on the 10th user and then notify the 11th that unfortunately we’ve reached capacity? Or depending on use case, maybe that 11th user will see that the form is now closed and they are too late.
What I am going to share with you is unsupported. I have previously demonstrated how you can download the data from forms direct from the API back in August of last year (2021). You can watch that here.
Shutting down a Microsoft Form
If you have built a form and navigate to the elipses and settings, you can untick the box to Accept Responses and set a message. We are going to automate this in one single action within Power Automate.
The API endpoint consists of a tenant id, group or user id and a form id. If you are looking to read up on the specifics, I suggest you watch my video or read up on Hiro’s blog post here
Below is the body that you must submit in order to update the closed status to true or indeed false if you want to re-enable your form. You can also set the form closed message. I have made this dynamic to indicate when the form was closed. This is displayed to the end user.
{ "settings": "{ \"FormClosed\":true, \"FormClosedMessage\":\"We have reached capacity - @{formatDateTime(utcnow(),'dd/MM/yyyy HH:MM:ss')}\" }" }
The single action
We simply send a PATCH to the forms api, with basic header information and the json output (per above). In order to do this we need to update the tenant, group/user id and forms id based on the Uri in the screenshot below.
/formapi/api/16c901d1-9763-49b1-961c-6cd701f5d0f7/users/6c646262-4f6f-4bfb-88c7-86b3d1252cac/forms('0QHJFmOXsUmWHGzXAfXQ92JiZGxvT_tLiMeGs9ElLKxUNEtSR05HNjNMNlZDMERZTEMzREc5SDFZWi4u')
How would you implement this?
This is all down to your specific use case. It’s possible to return the number of rows on a form submission and based on that number you could implement a condition. Similarly, if you are adding users to an event, you could count the number of attendees for that event. Maybe you could even delete the event from the form instead of disabling the form? I think that’s a challenge for another day.
What do you think? Is there a need for this functionality natively? Let me know in the comments below and if you are looking to add users to an outlook event, why not read this post?
I would like to do something like this except I would like to have my form turn on every Thursday morning and turn off every Tuesday night. I’m still somewhat of a novice Powerautomate user (I have built a couple-dozen flows, some of them connected in some way to Sharepoint or MS Forms). I wish MS forms would have more of these kinds of options natively.
I’d love to be able to set it up so that if I have a registration form that has multiple dates to choose from with limited capacity per date, it would close that specific date once capacity was reached. So, say Tuesday’s event is full, then that will no longer be an option- or would somehow show as full. Right now the workaround is a separate link for each event- but that seems inconvenient for the user.
As always, I truly appreciate this detailed post! This method worked great for the past six months, but the http request to Forms stopped working for me recently with a ‘Bad Request’ error. The only additional information in the flow is ‘Unexpected response from the service,’ which doesn’t help much with troubleshooting.
Have others had a similar experience? Wondering if this failure could be related to permission changes in my organization’s environment.
It will be similar to my Forms blog. The SharePoint http action is now limited to SharePoint only. You can use the premium entra id http action.
Sorry, I hadn’t seen your response before replying to my previous post. Thank you for clarifying.
Disappointing to hear that SharePoint http action is limited now! My organization hasn’t authorized use of any premium connectors.
Graph Explorer output provides a little more information regarding the error:
“message”: “Resource not found for the segment ‘formapi’.”
Has Microsoft taken away the API?
Microsoft made changes to correct the SharePoint HTTP Request from working with anything outside SharePoint around September of 2024. More details in this thread, scrolling down to the post by Rintu Mondal on October 1st, 2024: https://community.powerplatform.com/forums/thread/details/?threadid=9ca4e187-9e76-ef11-a671-000d3a9e52a3&action=reply&force_isolation=true
TL;DR: this can still work, but you need to have premium licensing and use the (premium) connector “HTTP with Microsoft Entra ID (preauthorized)” and the action “Invoke an HTTP Request”, specifying the url: https://forms.office.com during the first use. After that, the action looks like any other HTTP Request, and it does work. There are two very similar connectors; the one without “(preauthorized)” did not work for me, and the post above also references the pre-auth version. Searching for “Invoke” may help find this in the Power Automate designer. I realize this is an older post, but I often come here and search to find your wonderful, clever solutions, and it’s obvious others do too. Thank you for all the great content!!!
Thank you 🙏 I appreciate you sharing your findings.