Working with Voting Option Using MapiMessage
Creating Voting Option Using MapiMessage
Microsoft Outlook lets users create a poll when composing a new message. It lets them include voting options such as Yes, No, Maybe, etc. Aspose.Email allows the same while creating a new Outlook message. The FollowUpOptions class provides the VotingButtons property that can be used to set or get the value of voting options. This article provides a detailed example of creating a MapiMesasge with voting options for creating a poll.
Reading Voting Options from a MapiMessage
The following code snippet shows you how to Read Voting Options from a MapiMessage.
For complete examples and data files, please go to https://github.com/kashifiqb/Aspose.Email-for-C | |
System::SharedPtr<MapiMessage> message = MapiMessage::FromFile(fileName); | |
// This method can be useful when except voting buttons it is necessary to get other parameters (ex. a category) | |
System::SharedPtr<FollowUpOptions> options = FollowUpManager::GetOptions(message); | |
// Voting buttons will be introduced as a string with semi-column as a separator | |
System::String votingButtons = options->get_VotingButtons(); |
Reading Only Voting Buttons
The following code snippet shows you how to read only voting buttons.
Adding voting button to an Existing Message
The following code snippet shows you how to add voting button to an existing message.
Deleting Voting button from a Message
The following code snippet shows you how to delete vote button from a Message.
Read the Vote Results Information
The following code snippet shows you how to read the vote results information.
For complete examples and data files, please go to https://github.com/kashifiqb/Aspose.Email-for-C | |
System::SharedPtr<MapiMessage> msg = MapiMessage::FromFile(dataDir + L"AddVotingButtonToExistingMessage.msg"); | |
{ | |
auto recipient_enumerator = (msg->get_Recipients())->GetEnumerator(); | |
decltype(recipient_enumerator->get_Current()) recipient; | |
while (recipient_enumerator->MoveNext() && (recipient = recipient_enumerator->get_Current(), true)) | |
{ | |
System::Console::WriteLine(System::String::Format(L"Recipient: {0}",recipient->get_DisplayName())); | |
// Get the PR_RECIPIENT_AUTORESPONSE_PROP_RESPONSE property | |
System::Console::WriteLine(System::String::Format(L"Response: {0}",recipient->get_Properties()->idx_get(MapiPropertyTag::PR_RECIPIENT_AUTORESPONSE_PROP_RESPONSE)->GetString())); | |
// Get the PR_RECIPIENT_TRACKSTATUS_TIME property | |
System::Console::WriteLine(System::String::Format(L"Response time: {0}",recipient->get_Properties()->idx_get(MapiPropertyTag::PR_RECIPIENT_TRACKSTATUS_TIME)->GetDateTime())); | |
System::Console::WriteLine(); | |
} | |
} |