Two level subfolders help

Hello Wonderfull People,
i need your help with this problem.

I want my robot to acces a two level outlook inbox. I meant, there are mainly two folders inside my inbox. and then in each folders there are several subfolders i have to access and make differents tasks.
In other words i have this structure:

Inbox - folderA and folderB
inside folderA : SubfoldersA1, SubfoldersA2,… Subfolders10
inside folderB : SubfoldersB11, SubfolderB12,… SubfolderB20

i wanted to create a loop to acces all the subfolders just to create one unique list of unread emails and having red categories (Set in Lista Variable)
here in this picture below you will be able to see how i build my case.

“lstEmailFolders” is a variable which i created a list of differents paths i want my robot to go (folders and subfolders) to recuperate emails.
then i use a for each activity to go into each lstEmailFolders elements just to recuperate emails and create a unique list of emails ( Lista )

However , once i run the program i got this error message:
Capture26

Please any advice make it work would be appreciated…

Thanks,
Richch

@Ricchch

As you are Concat the list, there might be changes of null from any of the iteration

Try to check if the List is having the items and not null

Maybe you can put a condition as LIST.Length > 0

Then you can assign

Hope this may help you

Thanks,
Srini

1 Like

Hello @Srini84 and thanks for helping,
could you please indicate me where to write the condition:
condition as LIST.Length > 0 (sorry i am new on this)
image

Where:

LISTA=Enumerable.Concat(ListA.AsEnumerable,List.AsEnumerable).tolist

Thanks a lot,

@Ricchch

It’s a condition to check if the List you are trying to add is not empty

If you are not able to get List.Length then try with List.Count

So, use If and write there

Thanks,
Srini

Hello @Srini84 ,
thanks again for helping,
i am new i am trying to understand,
you meant i need to set a condition in the for each properties (input)
the place i marked on red (picture below) ?
in the picture you will find how i set my variables.
i am trying to figure it out what is my mistake…
Please advise me how to debug
Thanks

@Ricchch

Use IF activity after Get Outlook Mail Message and write the condition

Thanks,
Srini

@Ricchch

In then Part you can put the Assign activity

Thanks,
Srini

@Srini84
it is what you meant


thanks

@Ricchch

As I said can you try with List.Count > 0 ?
Put the Assign activity inside the Then Sequence

Thanks,
Srini

@Srini84

here is what i got

Thanks for helping,…

@Ricchch

So, the LIST is not getting the mails and It is giving Null

You can check why it is getting null

Have you initialize the list?

Thanks,
Srini

could you please indicate me how to check if it is initialized ? or how can i initialize …?
Thanks

@Ricchch

You can check below post for your reference

Hope this may help you

Thanks,
Srini

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