Unable to assign Mail Subject to a variable, can anyone diagnose why?

@loginerror @emailloginhelpp
Am unable to assign mail subject to a variable in Outlook
Subjectbased.xaml (8.2 KB)

Hey @u322805,
The problem is that your sent mail is a List, which is correct, since “Get Outlook Mail Messages” returns a list of messages.
But to get he subject you need to get a subject of a specific Message, not the whole list of messages.
Currently your “Get Outlook Mail Messages” activity return the top two messages:
To get the Subject of the first of these messages your Assign activity should look like this:
subjectmail = sentmail(0).subject
And that will return the subject of the first mail message in the list returned from “Get Outlook Mail Messages” activity.

Hope this helps!

1 Like

Dear Ziga,
Thank you so much for your swift reply, so kind of you.
But now the problem is it reads only the first mail, is there a way to read it one by one and compare
Something of this kind
subjectmail = sentmail(current + next).subject

Im not quite sure what you want to compare, or what you want to achieve there, but I guess the For Each Activity should be used similarly to what you already have used in the process. That one would then read the Subject for each mail seperatly, and you could do with each one what you want.

Wait a second, are you trying to make a bot that check if all the incoming mails have been anwsered? Because that seems to be the case but im not sure…

1 Like

Dear Ziga,
Absolutely yes
We will have to take subject of each mail from “inbox” and compare it with mails in “Sent items” if the subject line matches (“RE: subject”) then for that particular mail we will have to subtract the dates (Date of email received - date of reply sent), if reply not sent it should ignore and take the next mail from inbox and compare it again with the mails in sent items

OK, well you will have some work to do but its definetly doable. It will be a bit more complex then you expected though :slight_smile:
Simply because of the logic.
You will need two nested for each loops, since you will take subject rom each mail in “Inbox” and compare it to each mail in “Sent items”.

Hope this helps you out! If you get stuck let me know.

P.S. Based on the topic, I think my first response is the anwser, so if you want further help, could you mark that one as the Anwser and open a new topic with the description of your usecase. Just so it dosnt get confusing for other searching for the same problem in the forum :slight_smile:

1 Like

Done @ziga.hanzic … Let me try with the idea you gave

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.