Server Replied: No the specified message set is invalid.

Category: outlook for developers

Question

customDev on Wed, 05 Apr 2017 15:23:03


I am trying to use the IMAP library for C# to write a custom program that parses emails and serves the data to our ticketing system, when I try to move a bunch of emails to a different folder, I get an error message like so: 

Server replied: NO the specified message set is invalid.

I am using OUTLOOK email.

Any suggestions.



Replies

Kareninstructor on Wed, 05 Apr 2017 17:15:20


Hello,

If you like we can move your question to the forum "Outlook for developers"

Deepak Saradkumar Panchal on Fri, 07 Apr 2017 02:50:37


Hi customDev,

you did not posted the code , so we don't know what you doing wrong in your code.

so a reference you can refer code below.

using Limilabs.Mail;
using Limilabs.Client.IMAP;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        using (Imap imap = new Imap())
        {
            imap.Connect("imap.example.com");   // or ConnectSSL for SSL
            imap.UseBestLogin("user", "password");

            imap.SelectInbox();
            List<long> uids = imap.Search(Flag.Seen);
            foreach (long uid in uids)
            {
                imap.MoveByUID(uid, "Inbox/Seen");
            }
            imap.Close();
        }
    }
};

Reference:

Move emails to different folder with IMAP

other alternative approach

How to: Programmatically Move Items in Outlook

Regards

Deepak

PSBRS on Wed, 06 Dec 2017 18:00:20


I have also the same problem and facing it from the telnet level

Can someone explain me what is not good with this dialog

im: [connection] Connected to host
im: <= '* OK The Microsoft Exchange IMAP4 service is ready. [BASE64==]'
im: => 'A0 CAPABILITY'
im: <= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOV
E ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
im: <= 'A0 OK CAPABILITY completed.'
im: => 'A1 LOGIN "name@domain.tld\\\\SHARED" "password"'
im: <= 'A1 OK LOGIN completed.'
im: => 'A2 CAPABILITY'
im: <= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOV
E ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICAT
E CHILDREN IDLE NAMESPACE LITERAL+'
im: <= 'A2 OK CAPABILITY completed.'
im: => 'A3 NAMESPACE'
im: <= '* NAMESPACE (("" "/")) NIL NIL'
im: <= 'A3 OK NAMESPACE completed.'
im: => 'A4 LIST "" ""'
im: <= '* LIST (\\Noselect \\HasChildren) "/" ""'
im: <= 'A4 OK LIST completed.'
im: => 'A5 SELECT "INBOX"'
im: <= '* 3 EXISTS'
im: <= '* 0 RECENT'
im: <= '* FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft $MDNSent)'
im: <= '* OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft $MDN
Sent)] Permanent flags'
im: <= '* OK [UNSEEN 2] Is the first unseen message'
im: <= '* OK [UIDVALIDITY 14] UIDVALIDITY value'
im: <= '* OK [UIDNEXT 33] The next unique identifier value'
im: <= 'A5 OK [READ-WRITE] SELECT completed.'
im: => 'A6 UID SEARCH UNSEEN'
im: <= '* SEARCH 27 28'
im: <= 'A6 OK SEARCH completed.'
im: => 'A7 FETCH 27 (UID FLAGS INTERNALDATE BODYSTRUCTURE BODY[HEADER.FIELDS (FR
OM TO SUBJECT DATE)])'
im: <= 'A7 NO The specified message set is invalid.'
Fetch error: Error: The specified message set is invalid.
im: => 'IDLE IDLE'
Done fetching all messages!
im: <= '+ IDLE accepted, awaiting DONE command.'
im: => DONE
im: <= 'IDLE OK IDLE completed.'
im: => 'A8 LOGOUT'
im: <= '* BYE Microsoft Exchange Server IMAP4 server signing off.'
im: <= 'A8 OK LOGOUT completed.'
im: [connection] Ended
Connection ended
im: [connection] Closed

Deepak Saradkumar Panchal on Thu, 07 Dec 2017 08:27:11


Hi PSBRS,

I suggest you to create a new thread for your issue.

this thread is inactive from long time.

if you create a new thread then there is a more possibility of getting solution and suggestions from community members.

so you can try to create a new thread for your issue, provide maximum details with code.

we will try to make a test with it and try to provide you a solution for your issue.

Thanks for your understanding.

Regards

Deepak