Check if an e-mail list contains one specific e-mail

Hello!

I have two list of e-mails from outlook, List1 and List2.
There is any method to check if an e-mail from List1 is present in List2.
I tried something like, List1.Any(Function(x) List2.Contains(x)) but is not working.

Thank you!

Hi @Andrei_Croitoru

You can check with the Subject of the two mails.
Just Give it a try

List1.Any(Function(x) List2.Subject.Contains(x))

Regards
Sudharsan

Thank you!

But…

Hi @Andrei_Croitoru

Please try this

For check the subject

List1.any(function(x) list2.any(function(y) y.subject.tostring.trim.tolower.contains(x.subject.tostring.trim.tolower)))

For check the sender email address

List1.any(function(x) list2.any(function(y) y.senderemailaddress.tostring.trim.tolower.contains(x.senderemailaddress.tostring.trim.tolower)))

On what details you want to compare the two lists(like subject,sender name etc…)

Thanks

2 Likes

Thank you!

The HashCode would be perfect. If it’s possible.

Please give a try,

list1.any(function(x) list2.any(function(y) y.gethashcode.tostring.trim.equals(x.gethashcode.tostring.trim)))

Thanks

Maybe Intersect can help directly or modified on a comparable attribute

List1.Intersect(List2).toList

Hi @Andrei_Croitoru is that worked?

Thanks

I have made a combination with all the answers.
It worked.
Thank you!

2 Likes

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