The following sample code shows how you can delete a poll answer.
[C#]
using CMS.Polls;
...
string pollName = "testingSitePoll";
// Get poll info for the specified code name PollInfo pollObj = PollInfoProvider.GetPollInfo(pollName);
if (pollObj != null) { // Get all poll answers DataSet answers = PollAnswerInfoProvider.GetAnswers(pollObj.PollID);
if (!DataHelper.DataSourceIsEmpty(answers)) { // Create pollanswerinfo object from datarow PollAnswerInfo pollAnswerObj = new PollAnswerInfo(answers.Tables[0].Rows[0]);
if (pollAnswerObj != null) { // Delete poll answer PollAnswerInfoProvider.DeletePollAnswerInfo(pollAnswerObj); } } } |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_deleting_a_poll_answer.htm