2

I am trying to update flag of a email message from offcie 365 account from 'seen' to 'unseen' using node imap. I don't get any error but the message still remains seen. Same code works for Gmail. Similar logic works for office 365 for flagging a message with 'flag' and to mark message as 'seen'.

Any idea why 'seen' to 'unseen' doesn't works for Office ? Below is my code snippet

imap.setFlags(seqno, 'UNSEEN', function(err) { //Tried Unseen, unseen etc..
              if (err) return err;
              imap.closeBox(function(err) {
                if (err) return err;
                imap.logout();
              });
            }); 
Rajjy
  • 176
  • 13
  • 1
    You need to *remove* the \Seen flag. 'UNSEEN' is a search term, not a flag. – Max Oct 22 '19 at 14:22
  • Hi Max, i could mark a email message from seen to unseen for Gmail. It doesn't work for office365. You mean to mark a email as unseen, I will just have blank space at flag ? i.e. imap.setFlags(seqno, '', function(err) ? This too doesn't work for office 365 – Rajjy Oct 23 '19 at 04:32
  • imap.delFlags(seqno, 'seen', function(err) works. But wondering why setting flag to 'unseen' doesn't work for Office365. – Rajjy Oct 23 '19 at 04:52

1 Answers1

0

As mentioned by Max, 'delFlags' works out. But wondering why setting flag to 'unseen' doesn't work for Office365.

Rajjy
  • 176
  • 13