This project is read-only.

Error when downloading messages by Uid()

Topics: Issues
Jan 22, 2014 at 11:23 PM
Hi Pavel,

I just want to get messages by UId and set them as seen.
here is my code:
            Dim f As ImapX.Folder = cli.Folders.Inbox
            f.Messages.Download(arr)
            For Each m As ImapX.Message In f.Messages
                  m.Seen = True
             Next
arr contains the UIds.
I get an error in the f.Messages.Download(arr) row.

By debugging the source code, I've found that the error is because BodyParts is null (row 548 messages.cs)
         foreach (MessageContent bodyPart in BodyParts)
is into the method:
   public bool Download(MessageFetchMode mode = MessageFetchMode.ClientDefault, bool reloadHeaders = false)
Any suggestion ?
Thanks.

Best regards,
Francesco
Jan 23, 2014 at 12:35 AM
Without changing anything, now I'm able to get the messages by UIDs

Actual problem:
if I get messages by UIDs, I get a [READ-ONLY] session (please see log below), so I CANNOT mark as SEEN.

If I Download the UNSEEN messages, then all is ok.

Any suggestion ?
IMAPX3 LIST "" %

* LIST (\HasNoChildren) "/" Drafts
* LIST (\NoInferiors) NIL INBOX
* LIST (\HasNoChildren) "/" "Sent Items"
* LIST (\HasNoChildren) "/" trash
IMAPX3 OK LIST completed
IMAPX4 EXAMINE "Drafts"

* 0 EXISTS
* 0 RECENT
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] cannot change any flags
* OK [UIDVALIDITY 1381496218] mailbox UID validity
* OK [UIDNEXT 1] predicted next UID
IMAPX4 OK [READ-ONLY] EXAMINE complete
IMAPX5 EXAMINE "INBOX"

* 335 EXISTS
* 0 RECENT
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] cannot change any flags
* OK [UIDVALIDITY 1239258136] mailbox UID validity
* OK [UNSEEN 334] first unseen message number
* OK [UIDNEXT 363] predicted next UID
IMAPX5 OK [READ-ONLY] EXAMINE complete
IMAPX6 EXAMINE "Sent Items"

* 7 EXISTS
* 0 RECENT
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] cannot change any flags
* OK [UIDVALIDITY 1381496218] mailbox UID validity
* OK [UIDNEXT 8] predicted next UID
IMAPX6 OK [READ-ONLY] EXAMINE complete
IMAPX7 EXAMINE "trash"

* 18 EXISTS
* 1 RECENT
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] cannot change any flags
* OK [UIDVALIDITY 1239258900] mailbox UID validity
* OK [UNSEEN 1] first unseen message number
* OK [UIDNEXT 26] predicted next UID
IMAPX7 OK [READ-ONLY] EXAMINE complete
Coordinator
Jan 23, 2014 at 10:07 AM
Hi agilesferlix,

thank you for the log! I see the problem, actually two, and will provide a fix this weekend!

Greets,

Pavel
Coordinator
Jan 27, 2014 at 9:48 AM
Edited Jan 27, 2014 at 9:51 AM
Hi agilesferlix,

can you check the latest source code in repoitory? Now the problem should be solved.

Best regards,

Pavel
Jan 31, 2014 at 2:27 PM
Hi Pavel,

sorry for the delay, I was not at work.
The code is always the same. The only difference is that, instead of passing "ALL", I pass the UID array into the folder.download statement

I've seen your last update. I did not test it against my code.
I'll let you know if it works or not.

thank you
francesco



2014-01-27 pavel_azanov <[email removed]>:

From: pavel_azanov

Hi agilesferlix,

Just took another look at the log, actually it only contains information on the results of the examine commands. After calling the Folder.Search method, the folder should be selected in read-write mode. Can you give more details on your actual code?

Best regards,

Pavel

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com