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?