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.
![](https://i0.wp.com/damobird365.com/wp-content/uploads/2022/09/image-4.png?resize=374%2C607&ssl=1)
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')}\" }" }
![Microsoft Form personalised message](https://i0.wp.com/damobird365.com/wp-content/uploads/2022/09/image-5.png?resize=665%2C345&ssl=1)
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.
![Single action to disable or enable a microsoft form](https://i0.wp.com/damobird365.com/wp-content/uploads/2022/09/image-6.png?resize=618%2C566&ssl=1)
/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.
![If the number of attendees is greater than 4, disable form, else add them to the event](https://i0.wp.com/damobird365.com/wp-content/uploads/2022/09/image-8.png?resize=740%2C382&ssl=1)
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.