additional question for 1304

on the moved message (copy and delete orignal one) the message id remains unchanged. So maybe it's a good way to search for this message id after operation, and get the MessageInfo (UniqueID) as search result. But at the moment i don't know how to search for the message id? Can you recommend this way?

asked 07 Apr '11, 14:41

martin's gravatar image

martin
745
accept rate: 0%

edited 07 Apr '11, 14:43

Jan%20Sotola's gravatar image

Jan Sotola ♦♦
3566


Yes, this is possible and looks like a good idea:

' select the target folder
imap.SelectFolder("Target Folder")

' search for messages with the specified messageId in "Message-Id" header
Dim list as ImapMessageCollection = imap.Search(ImapListFields.UniqueId, ImapSearchParameter.Header("Message-Id", messageId))

' of the number of messages found is not 1, report error
If list.Count <> 1 Then
    Throw New ApplicationException("None or multiple message found.")
End If

' get the new message ID
Dim newUniqueId As String = list(0).UniqueId

Please note that not all messages are guaranteed to have message ID, and not all message IDs are guaranteed to be unique (because they are generated by the sender). However, the code above should work in almost all cases.

link

answered 07 Apr '11, 15:50

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×76
×6

Asked: 07 Apr '11, 14:41

Seen: 589 times

Last updated: 07 Apr '11, 15:50