PowerTCP Mail for .NET
Message Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > ImapMessageEventArgs Class : Message Property




Gets an ImapMessage object representing the message for which the event was raised.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Message As ImapMessage
Visual Basic (Usage)Copy Code
Dim instance As ImapMessageEventArgs
Dim value As ImapMessage
 
value = instance.Message
C# 
public ImapMessage Message {get;}
Managed Extensions for C++ 
public: __property ImapMessage* get_Message();
C++/CLI 
public:
property ImapMessage^ Message {
   ImapMessage^ get();
}

Property Value

Returns an ImapMessage object representing the message.

Example

The following example demonstrates using the Mailbox.BeginSearch method. This example constructs the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'"
Visual BasicCopy Code
Private Sub AsynchronousSearchTest()
   ' Login
   Imap1.Login(Server, User, Pass)

   ' Construct the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'"
   Dim Criteria As New ArrayList()
   Criteria.Add(New ImapSearchParameter(ImapCriterion.Flagged, ""))
   Criteria.Add(New ImapSearchParameter(ImapCriterion.Since, "1-Feb-1994"))
   Criteria.Add(New ImapSearchParameter(ImapCriterion.Not, ""))
   Criteria.Add(New ImapSearchParameter(ImapCriterion.From, "Smith"))

   ' Alternatively, ImapSearchParameter objects can be created like so
   ' Dim Param As New ImapSearchParameter()
   ' Param.Criterion = ImapCriterion.Flagged
   ' Param.Paramter = ""
   ' Criteria.Add(Param)

   ' Perform the search. This will occur on the default box INBOX.
   Imap1.CurrentMailbox.BeginSearch(Criteria, Nothing)
End Sub

Private Sub Imap1_EndSearch(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.ImapMessageEventArgs) Handles Imap1.EndSearch
   If e.Exception Is Nothing Then
      ' The following messages meet the criteria
      Dim Msg As ImapMessages
      For Each Msg In e.Messages
         Debug.WriteLine("Message: " + Msg.Id)
      Next
   End Sub
End Sub
C#Copy Code
private void AsynchronousSearchTest()
{
   // Login
   imap1.Login(Server, User, Pass);

   // Construct the search "SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM 'Smith'"
   ArrayList criteria = new ArrayList();
   criteria.Add(new ImapSearchParameter(ImapCriterion.Flagged, ""));
   criteria.Add(new ImapSearchParameter(ImapCriterion.Since, "1-Feb-1994"));
   criteria.Add(new ImapSearchParameter(ImapCriterion.Not, ""));
   criteria.Add(new ImapSearchParameter(ImapCriterion.From, "Smith"));

   /*
   / Alternatively, ImapSearchParameter objects can be created like so
   / ImapSearchParameter param = new ImapSearchParameter();
   / param.Criterion = ImapCriterion.Flagged;
   / param.Paramter = "";
   / criteria.Add(param);
   */

   // Perform the search. This will occur on the default box INBOX.
   imap1.CurrentMailbox.BeginSearch(criteria, null);
}

private void imap1_EndSearch(object sender, Dart.PowerTCP.Mail.ImapMessageEventArgs e)
{
   if(e.Exception == null)
   {
      // The following messages meet the criteria
      foreach(ImapMessage msg in e.Messages)
         Debug.WriteLine("Message: " + msg.Id);
   }			
}

Remarks

The ImapResponseEventArgs.Message property returns the first message (Messages[0]). If a multiple messages are effected, use the ImapMessageEventArgs.Messages property.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.