How to "Enable Multiple Responses" using Graph API/REST API/PnP Powershell

Shreesha HD 0 Reputation points
2025-03-12T05:28:48.1633333+00:00

Need to "Enable Multiple Responses" in surveys using Graph API/REST API/PnP Powershell, not able to find any solution in Graph API/REST API. With PnP Powershell I was able to find some commands but I am getting InvalidOperation error

  1. Install the PnP PowerShell module (if you haven’t already): Install-Module -Name SharePointPnPPowerShellOnline -Force
  2. Connect to your SharePoint site: Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Credentials (Get-Credential)
  3. Enable the “Allow Multiple Responses” setting: $surveyList = Get-PnPList -Identity "YourSurveyListName" $surveyList.EnableMultipleResponses = $true $surveyList.Update() Invoke-PnPQuery
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,406 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 30,471 Reputation points Microsoft External Staff
    2025-03-12T09:31:49.3366667+00:00

    Hi @Shreesha HD ,

    Welcome to Q&A forum!

    This setting is typically configured through the SharePoint web interface by doing the following: Navigate to your Survey >> Click on “Setting” >> Survey Settings >> Click on “List name, description and navigation” >> Set “Allow multiple responses” to “Yes”.

    Reference: How to create a survey in SharePoint Online?

    Note: Non-official, just for reference.

    If you must need to "Enable Multiple Responses" in surveys using Graph API/REST API/PnP PowerShell, indeed as you said, PnP PowerShell is the most viable approach. Since for the Microsoft Graph API and SharePoint REST API, there isn't a direct endpoint to modify the "Allow Multiple Responses" setting for surveys. These APIs primarily focus on CRUD operations for list items and documents.

    An InvalidOperation error suggests there might be issues with the cmdlet usage or the environment setup. Here's how you can approach this:

    1. Ensure PnP PowerShell Module Compatibility:
    • The latest versions of the PnP PowerShell module (2.x and above) require .NET 6 and are compatible only with PowerShell 7 or later. They are not compatible with Windows PowerShell 5.1 or the Integrated Scripting Environment (ISE).
    1. Authenticate Using the Correct Method:
    • For environments with Multi-Factor Authentication (MFA), the -Interactive parameter is recommended for authentication.
    Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive
    
    1. Verify Survey List Existence and Permissions:
    • Ensure that the survey list exists on the specified site and that you have the necessary permissions to modify its settings.
    1. Implement Error Handling to Capture Detailed Errors:
    • Use a try-catch block to capture and analyze any exceptions that occur during the execution:
        try {
            $surveyList = Get-PnPList -Identity "YourSurveyListName"
            $surveyList.EnableMultipleResponses = $true
            $surveyList.Update()
            Invoke-PnPQuery
        } catch {
            Write-Error "An error occurred: $_"
        }
      
      This approach provides more detailed error information, aiding in troubleshooting. Reference: How to Use PowerShell Try Catch to Handle Errors? Note: Non-official, just for reference.
    1. Ensure Proper Cleanup of Connections:
    • Not properly disconnecting PnP connections can lead to unexpected errors in subsequent operations. Ensure that you disconnect after completing your operations.
        Disconnect-PnPOnline
      

    Hope these information helps.

    Please do let us know if you have any further queries.

    Kindly consider accepting the answer if the information provided is helpful. This can assist other community members in resolving similar issues.


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.