MoreBeerMorePower

Power Platform中心だけど、ノーコード/ローコード系を書いてます。

Get Question details of Forms with Power Automate

f:id:mofumofu_dance:20210827232348p:plain

Power Automate only allows you to get the response details using the Forms connector, it does not provide the question details of Forms survey - title, type, choices etc. .

In this post, I'll show you how to get the details of a Forms survey question in Power Automate.

Note that this is a tricky method that is not officially documented.

API to get question details

Forms API is not arrived/documented even today, but if you look at the network using the Chrome Dev tool, you will see that the following APIs retrieve the survey details :

#For group-owned form
https://forms.office.com/formapi/api/[tenantId]/groups/[groupId]/light/forms('[formId]')

#For user-owned form
https://forms.office.com/formapi/api/[tenantId]/users/[userId]/light/forms('[formId]')

*formId is in Url when opening form

f:id:mofumofu_dance:20210828001405p:plain

More precisely, they are called with some query parameters to select/expand fields

?$select=id,title,modifiedDate,createdDate,meetingId,formsInsightsInfo,description,questions,descriptiveQuestions,permissions,responderPermissions,permissionTokens,rowCount,settings,background,otherInfo,logo,xlWorkbookId,xlExportingTag,xlFileUnSynced,xlUnsyncedReason,category,trackingId,predefinedResponses,thankYouMessage,emailReceiptEnabled,.....

If you need to get only questions detail, above queries can be reduced to

?$select=id,title,questions&$expand=questions($expand=choices)

f:id:mofumofu_dance:20210827235914p:plain
Response data include question detail, survey setting etc.

Call API in Power Automate

Another tricky part of calling this API in Power Automate is to use the SharePoint connector action - "Send HTTP request to SharePoint".

f:id:mofumofu_dance:20210828000637p:plain

Using this action, you can get response with following parameters

f:id:mofumofu_dance:20210828001210p:plain

Done! You got the question details of Forms survey, just a single action!

f:id:mofumofu_dance:20210828001727p:plain