DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

David has posted 73 posts at DZone. View Full User Profile

How to Create & Send Email Message with Voting Options inside .NET Apps

06.04.2014
| 1483 views |
  • submit to reddit
//Creating and Sending a Message with Voting Options

//The following code sample shows how to create a new message and then send it with voting options.

//[C#]

string address = "firstname.lastname@aspose.com";

using (IEWSClient client = EWSClient.GetEWSClient("https://exchange.aspose.com/ews/Exchange.asmx", "username", "password", "aspose.com"))
{
    MailMessage message = CreateTestMessage(address);

    FollowUpOptions options = new FollowUpOptions();
    options.VotingButtons = "Yes;No;Maybe;Exactly!";

    client.Send(message, options);
}
 
//[VB.NET]

Dim address As String = "firstname.lastname@aspose.com"

Using client As IEWSClient = EWSClient.GetEWSClient("https://exchange.aspose.com/ews/Exchange.asmx", "username", "password", "aspose.com")
	Dim message As MailMessage = CreateTestMessage(address)

	Dim options As New FollowUpOptions()
	options.VotingButtons = "Yes;No;Maybe;Exactly!"

	client.Send(message, options)
End Using

//Sample Methods Used in Examples

//[C#]

private static MailMessage CreateTestMessage(string address)
{
    MailMessage eml = new MailMessage(
        address,
        address,
        "Flagged message",
        "Make it nice and short, but descriptive. The description may appear in search engines' search results pages...");

    return eml;
}
 
//[VB.NET]

private static MailMessage CreateTestMessage(string address)
{
    MailMessage eml = new MailMessage(
        address,
        address,
        "Flagged message",
        "Make it nice and short, but descriptive. The description may appear in search engines' search results pages...");

    return eml;
}
This technical tip explains how to create & send an email message with voting options inside .NET Applications. Microsoft Outlook allows users to create a poll when composed a new message. This is done by including voting options such as Yes, No, Maybe, etc. The FollowUpOptions class offered by Aspose.Email, provides the VotingButtons property that can be used to set or get the value of the voting options. This article provides a detailed example of creating a MapiMessage with voting options for creating a poll and then sending the message using Exchange Web Service (EWS) client.