I connect to outlook.office365.com for synchronizing emails by library IMAPClient (Python). By IDLE mechanizm I receive changes on server for example new email in folder INBOX. After that I fetch for mails with UID {last_synced_uid}:* - this should give me all mails after last sync (UID are always incremented).
This flow works but from time to time IMAP server (outlook.office365.com) does not return new mail but already synchronised. Running full synchronization sometimes work but not always - I mean search mails after date and fetching by UID.
In this situation I manually move mail from INBOX to other folder and move again to INBOX and this always works - after that my script detects new mail in INBOX and fetch with UID {last_synced_uid}:*
It looks like Office365 sometimes has problem with fetching by UID.
The same mail is visible in other mail client like thunderbird so maybe there is some workaround or it is a bug in IMAPClient/imaplib
Below logs for monitoring folder where last_synced_uid is 1619:

IDLE RESPONSE: [(10, b'RECENT'), (618, b'EXISTS')]
start FETCH UIDs 1620:*
FETCH returns mail with UID 1619, SEQ 617
last_synced_uid 1619 did not changed
I will answer my own question - selecting the same folder on IMAP connection many times could generate this problem.
Office365 IMAP sometimes fetching new emails not working