Need assistance on creating Microsoft forms dynamically with questions and prefilled answers using c# MVC web app and generate form links

Vamshi Konatham 0 Reputation points
2025-02-04T07:30:22.0566667+00:00

Hello,

We have a requirement to create Microsoft forms specific to users with questions like textbox, dropdown, dropdown (multiselect) etc., and prepopulate or pre-fill the answers related to user specific data into the questions and then share the form link with the respective user and then we need to capture the user response from the form and update user's data in our database. I'm able to look at the documentation to read the user response for a Microsoft form (already created) using form id OAuth authentication but unable to find articles to create Microsoft forms dynamically with questions and prefilled answers and share the links with the users. We need to implement this programmatically using c# in MVC web application. Can you please let us know the possibility of achieving this and if so can you please share the articles for reference to implement the above mentioned functionality.

Thanks & Regards,
Vamshi

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,337 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,105 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 72,996 Reputation points
    2025-02-04T23:14:59.4066667+00:00

    typically this would be two applications.

    a creator app that defined the questions, answer type, and values which was stored in a database.

    a user app that asked the question, and stored the answers in a database.

    you can get sample quiz programs which are pretty common. google "asp.net mvc quiz applications"

    sample (don't know quality):

    https://www.youtube.com/playlist?list=PLX4n-znUpc2Y8Thf9TjLn8D7pSYDcqubl


  2. Bhargavi Naragani 1,690 Reputation points Microsoft External Staff
    2025-02-07T03:20:02.06+00:00

    Hi @Vamshi Konatham,
    Welcome to the Microsoft Q&A Platform!

    Unfortunately, Microsoft Forms has no official API that would enable you to generate forms or auto-fill responses prior to distributing the link. Microsoft Forms' API is largely dedicated to the collection of responses submitted to existing forms but doesn't provide features to create new forms or populate pre-filled responses. Though it has no native APIs for the following actions, here are a few workarounds you could apply:

    1. If your organization uses Microsoft Forms Pro, now known as Dynamics 365 Customer Voice, you might be able to create forms dynamically using Power Automate or the Common Data Service (CDS). By combining Power Automate with C# API calls, you can automate the process of creating forms, send unique links to users, and gather their responses. However, even with these tools, there’s no straightforward way to pre-fill answers before the user submits the form.
    2. Alternative Solution: Custom Web Form with Microsoft Forms API. Since it is not possible to dynamically create forms in Microsoft Forms, an alternative approach might be to:
      • Create a custom form interface in your C# MVC application to look and feel like Microsoft Forms.
      • Use a database to store the structure of your forms and any pre-filled answers. Collect user response directly in your database.
      • Sync responses to the Microsoft Forms API as required and then track them.
    3. While Microsoft Forms doesn't have a built-in way to automatically fill in answers, there's an option you might be able to try. Sometimes, you can use query parameters in the URL that might pre-fill some of the text-based answers. However, this trick only works for questions where you type in the answer. It won't work for things like dropdown menus or questions where you can select multiple choices.
    4. Google Forms supports already-filled answers via URL parameters, and its API provides the ability to create forms programmatically, which might be a viable alternative if you're open to other solutions.

    Overview:
    https://learn.microsoft.com/en-us/power-automate/forms/overview

    Hope the above provided information help in better understanding and help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
    If the answer is helpful, Kindly Upvote it

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.