UIDPlusResult Property


Gets the APPENDUID or COPYUID value of the last response from the IMAP4 server.

It's a string containing two space-separated values, like "83452345 129" or "345849 91:93" or "942378 5,9,12:16". The first value is the new value of UIDVALIDITY of the destination mailbox. The second value is the UID or a set of UIDs in IMAP4 message set format. The second value denotes the UID or UIDs assigned to the resulting messages in the destination mailbox (uploaded, copied or moved to that mailbox).

This value is only available if the IMAP4 server supports UIDPLUS extension (you can use GetCapabilities method to check this). If it does, the commands like APPEND, COPY and MOVE will set this value if the operation succeeded.


Value Type: Long
Parameters: None 
Remarks: This property is read-only.

Usage example:

' This sample copies the last message in Inbox into Sent folder (it must exist in the account).
' Then it gets UIDPLUS result and extracts the last value from it which denotes the UID assigned to the copied message in Sent folder.

Dim Mailer, Values, AssignedUID
' 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

' Logging is not necessary but useful for troubleshooting
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"
Mailer.ClearLog

Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
   ' Select the source mailbox first
   If Mailer.SelectMailbox("Inbox") Then
      If Mailer.CopyMessages("Sent", Mailer.MessageCount, Mailer.MessageCount, False) Then
        ' This is how you can extract second (the last) value from UIDPlusResult string.
        Values = Split(IMAP.UIDPlusResult)
        If (UBound(Values) > LBound(Values)) Then
          AssignedUID = Values(UBound(Values))
          MsgBox "Assigned UID=" & AssignedUID
        End If
      End If
   Else
      MsgBox "Error."
   End If
   Mailer.Disconnect
Else
   MsgBox "Unable to connect."
End If

See Also:

AppendMessage Method | CopyMessages Method | MoveMessages Method | IMAP4 Object


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.