FILTER MAIL BY IUD

I have a process in two parts I retrieve emails on sub folders and retrieve and store them in different directories. however the mail box ands shared by several people so I can not use unread message How shoud I dot .

Any solution