SetFlagsForMessage Method


Sets the flags for a message in the currently selected mailbox.


blnResult = ObjectName.SetFlagsForMessage(Index, AsUID, Flags, Action)  
Parameters:  
Index As Long Message number of Unique-ID of the message to set flags for  
AsUID As Boolean If False, Index is a message number. If True, Index is a Unique-ID  
Flags As Long Flags to be set for the message. Can be zero or any combination of the following:
  • 1 - Answered
  • 2 - Deleted
  • 4 - Draft
  • 8 - Flagged
  • 16 - Recent
  • 32 - Seen
 
Action As Long Indicates what to do with flags. Can be one of the following:
  • 1 - Set specified flags for the message
  • 2 - Remove specified flags from the message
  • 3 - Replace any existing flags with specified flags
 
Return value As Boolean True if successful, False if error has occurred  

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox

Mailer.EnableLogging = True ' Logging helps to discover any problems
Mailer.LogFilePath = "C:\imap4_log.txt"

Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then

  If Mailer.SelectMailbox("Inbox") Then

    ' Remove 'Answered' and 'Deleted' flags for the first message
    If Mailer.SetFlagsForMessage(1, False, 1 + 2, 2) Then
      MsgBox "Removed 'Answered' and 'Deleted' flags for message #1"
    End If

  End If

  Mailer.Disconnect
Else
  MsgBox Mailer.ErrDesc
End If

See Also:

DeleteMessages Method


Copyright 2002-2008, AfterLogic Corporation. All rights reserved.