Forum Discussion
ravipokala
Jun 15, 2020Copper Contributor
API to access MS forms
Looking for an API to access MS forms and pull the survey results on a weekly basis.
Kiko1st
Jun 14, 2022Copper Contributor
- mpheasantJun 14, 2022Copper ContributorEssentially you need to enumerate all the forms for anyone rather than just your own?
- If you can get a list of AAD users (and OID) you could query each one to see if they have any forms. MS Graph has a documented API to get users. Not sure this would be a great way to do it as probably very few people own forms. If you have a list of users in your org that have forms, you could look up their OID by hand or through MS Graph API.
- There might be a way in forms API to query all forms in a tennant but so far its undocumented.
- Maybe you can try browsing around the MS Forms interface with the console open looking at network queries with formapi in them, and see if anything looks like what you want. If there's a way to list all forms in your org through MS Forms app in the browser, then it will be using some API somewhere and you might discover it... - mpheasantJun 14, 2022Copper ContributorFind out about App Registration and OAuth to get token to access the API , see my post above where I mention : "An app registration with a bunch of permissions such as Responses.Read.All, Forms.Read.All and others (not sure exactly the minimum reqd)."
You may also need to be using a user or service account that has 'Collaborate' permissions to the specific form, I'm not 100% sure. - mpheasantJun 14, 2022Copper Contributorin my case, Owner ID is the Object ID in the AAD portal for the user who owns the form, not sure if there are other ways it can work with forms
- Kiko1stJun 14, 2022Copper ContributorYeah there are strange architectural choices in Customer Voice. My issue for example concerns translations : they are not accessible in the Dataverse either ...
When it comes to your issue ... I am kind of lost to be sincere. no clue what are those approval workflow ...
Anyway here's a pointer to postman ... smone tried to work on that but the work is still not finished :https://www.postman.com/sakamati/workspace/customervoice/documentation/4141638-20de1ef9-5922-4a50-bf44-5737b48d8e74 - Steve_LumJun 14, 2022Copper ContributorYes, thank you. The main Approval tables are available in CDS and I can access those. However, when one creates a custom template for Approvals the additional fields are behind-the-scenes created in the Forms repository, so the data collected as part of the custom approval workflow ends up in the forms responses - not in CDS/dataverse - which is why I need to bother with Forms at all. In my opinion, a bad architectural choice by MS. Dataverse knows/stores the form template IDs associated with Approvals so it would have been better to store that data in extension tables, e.g. ApprovalTemplateQuestions, ApprovalTemplateResponses.
- Kiko1stJun 14, 2022Copper Contributor
Postman is just a tool to work with APIs
Coming back to your issue: accessing responses ... not sure that what I will say apply to forms, but for sure it applies to Customer Voice and form pro : data is available in the dataverse tables.
They are accessible via sql queries : you just need the dynamics 365 dataverse address.
There are some limitations (you cannot get translations) but it may cover most of you need - Steve_LumJun 14, 2022Copper ContributorI'm sorry, I don't know what you are asking. I know what a form owner ID is, what I was asking was, where/how was mpheasant deriving the value(s) before construction the query URL. A tenant ID is essentially a constant that can be discovered easily in the Azure Portal but form owner IDs are "user metadata" that accrue over time as new forms are created. In order to query against those forms one would have to collect them before hand.
Right now I am struggling with accessing anything I don't explicitly "own", even though I am a member of Approvals App Admin Team. Custom approval templates are actually forms and I need to be able to read their responses, which is why I am in this game. It's a specific case within the larger general case of reading form responses, which I still cannot do with C# and ConfidentialClientApplicationBuilder.