Jun 15 2020
09:39 AM
- last edited on
Aug 03 2023
10:38 PM
by
TechCommunityAP
Jun 15 2020
09:39 AM
- last edited on
Aug 03 2023
10:38 PM
by
TechCommunityAP
Looking for an API to access MS forms and pull the survey results on a weekly basis.
Jun 15 2020 09:51 AM
@ravipokala an API has been promised for Forms for a long time but has never arrived. The solution is therefore to use a flow in Power Automate to save each form response to a list in SharePoint. You can either see the last week's responses there or you could have another flow with a recurrence schedule trigger set to 1 week. That would get the items created in the list in the last week and do whatever you want to do with it.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Sep 25 2020 03:28 PM
@RobElliott , a fairly good workaround. Unfortunately, Flows are prone to failing now and then and if you miss a response I guess there's no way to re-fetch it in retrospect?
Sep 27 2020 12:12 AM
@Martin Dreyer the response will still be in the spreadsheet behind the form, so you've still got the response even if the flow fails for some reason. Over the last 3 years I've found Power Automate to be very reliable and a flows will very rarely fail once you have properly tested it. Power Automate is far more reliable than Forms which, as this form shows, is far more prone to errors and things not working the way they should.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Nov 07 2020 11:52 AM
@ravipokala I'm using VBA + SeleniumBasic-2.0.9.0
You must first open the URL “https://forms.office.com/Pages/DesignPage.aspx” to obtain a token
Then you can call "https://forms.office.com/formapi/DownloadExcelFile.ashx?formid=" + put your form ID Here + "&timezoneOffset=180&minResponseId=1&maxResponseId=1000"
This is working for me
Nov 30 2020 03:58 AM
Nov 30 2020 04:26 AM
Hi @ssahal ! You just need access the URL “https://forms.office.com/Pages/DesignPage.aspx”, then in same section you calls "https://forms.office.com/formapi/DownloadExcelFile.ashx?formid=" + [put your form ID Here] + "&timezoneOffset=180&minResponseId=1&maxResponseId=1000"
The token is automatically generated in the site section.
So, unfortunately, you need to use a browser to use the API. I tried everything to get files using code and nothing worked.
If you find out how to generate the token by code, please share it with us! Tks
Nov 30 2020 04:38 AM
Dec 07 2020 10:48 AM
Looking forward to seeing what you come up with. Power Automate is often just to picking up that a form was submitted. So I'm looking at alternatives. Thanks.
Dec 10 2020 05:14 PM
I need a Microsoft Forms API so that I can programmatically create new forms/polls and add them to every Microsoft Teams meeting/invite or click a button during Teams meeting to send form out to all attendees. Each meeting should be able to use a same/similar forms template but generate a new form so that CEO can poll attendees and graph responses. It seems this capability should be here already. Would be nice to be able to generate the form from a forms template on the fly and provide a Microsoft Forms bot to deliver the poll to the user in an interactive format.
Feb 24 2021 01:46 AM
@JTAPPS-1exactly what I'm trying to do - programmatically create a microsoft form. After that I can use Logic Apps for example, but the creation of the form is what I'm missing. Simply put I have some variables in powershell that I want to become a microsoft form.
Mar 05 2021 11:09 AM
@badsector @JTAPPS-1 +1 to having Microsoft Forms API to be able to programmatically create forms. I've personally found the "branching" feature to not be very intuitive and more importantly error prone for creating more complex forms. I was hoping once I figured out high level details, that I could build the form much faster using automation. Perhaps even PowerShell cmdlets but would be okay with just REST API. This topic was extremely difficult to search for online and had to go through multiple forums to eventually land here which sounds like such an API does not exists
Oct 06 2021 10:28 AM
Oct 23 2021 12:51 PM
Oct 28 2021 10:22 AM
Nov 21 2021 08:19 PM
Dec 14 2021 10:44 PM
Mar 11 2022 12:44 AM - edited Mar 11 2022 01:34 AM
@PJ Johnson This is very helpful and has got me most of the way there, thank you.
I have given permissions for an app registration to access the microsoft forms API, with admin consent. I am using the client credential oauth 2 authentication flow to get a bearer token for this app registration to the https://forms.office.com/.default scope. However, when using that token with in the Authorization header of the API call to one of the endpoints listed, it tells me I am not logged in. I have tried using the bearer token scraped off a browser-based API call in it's place, and that works fine. So I know there's nothing wrong with my call, instead, something is wrong with my app registration authentication.
Given the error "701: Required user login", I am starting to think that app registrations just aren't working yet. But then, as you pointed out, the option is there to give Application API permissions in AD?!
How did you manage to do this? What am I missing?
Mar 11 2022 04:37 AM
@eddierthomas Can you provide some steps including app registration and how you are invoking the API
Jun 10 2022 09:19 AM