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




Gets the response code.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Code As ImapCode
Visual Basic (Usage)Copy Code
Dim instance As ImapResponse
Dim value As ImapCode
 
value = instance.Code
C# 
public ImapCode Code {get;}
Managed Extensions for C++ 
public: __property ImapCode get_Code();
C++/CLI 
public:
property ImapCode Code {
   ImapCode get();
}

Property Value

If a code was included with the response, this property will contain an ImapCode value describing the code received. If no code was included with the response, this property will contain ImapCode.None.

Example

The following example demonstrates using the LineReceived event to detect UIDVALIDITY codes.
Visual BasicCopy Code
Private Sub DoSomething()
   ' Log in. The Imap.LineReceived event will be raised when data is received
   Imap1.Login(Server, User, Pass)

   ' Send a NOOP
   Imap1.Noop()

   ' Log out
   Imap1.Logout()
End Sub

Private Sub Imap1_LineReceived(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.ImapResponseEventArgs) Handles Imap1.LineReceived
   Dim Response As ImapResponse
   ' Iterate through all responses.
   For Each Response In e.Responses
	  ' Check if it contained a UIDVALIDITY response.
      If Response.Code = ImapCode.UidValidity Then
         Debug.WriteLine("UIDVALIDITY is " + Response.CodeValue);
      End IF
   Next
End Sub
C#Copy Code
private void DoSomething()
{
   // Log in. The Imap.LineReceived event will be raised when data is received
   imap1.Login(Server, User, Pass);

   // Send a NOOP
   imap1.Noop();

   // Log out
   imap1.Logout();
}

private void imap1_LineReceived(object sender, Dart.PowerTCP.Mail.ImapResponseEventArgs e)
{
   // Iterate through all responses.
   foreach(ImapResponse response in e.Responses)
   {
      // Check if it contained a UIDVALIDITY response.
      if(response.Code == ImapCode.UidValidity)
         Debug.WriteLine("UIDVALIDITY is " + response.CodeValue);
   }
}

Remarks

This property returns the response code of the line. Codes are optional and contain additional information for the client beyond the status level and are provided so the user can take additional action upon the information contained in the code. For example, if the following line was received from the IMAP server,

* OK [UIDVALIDITY 1032904889] UIDs valid

the ImapResponse.Code property would contain ImapCode.UidValidity. This information is not included with all responses from the server.

See the ImapCode enumeration for possible code values.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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