Updating an existing poll

The following sample code shows how you can modify poll properties using the API:

 

[C#]

 

using CMS.Polls;

using CMS.SettingsProvider;

using CMS.DataEngine;

using CMS.GlobalHelper;

 

...

 

       string pollName = "testingpoll"; // Testing poll code name

 

       // Get poll info by code name

       PollInfo pollObj = PollInfoProvider.GetPollInfo(pollName);

 

       if (pollObj != null)

       {

           // Set the field values

           pollObj.PollResponseMessage = "Thank you for your time.";

           pollObj.PollAllowMultipleAnswers = true;

 

           // Save the changes

           PollInfoProvider.SetPollInfo(pollObj);

       }