jai_kumar2
(jai kumar)
February 21, 2023, 7:19am
1
Hi
iam using if condition to read mail attachment so if the attachment in any other format the process go to then -except “.xlsx”
if the attachment is .xlsx the process go to ELSE
i use the following condition - “CurrentMail.Attachments.Where(Function(x) x.Name.Contains(”*.pdf")).Count=1"
in above condition i need to include all formats except Excel to go ELSE
any posibile
Thanks in advance
Hi @jai_kumar2 ,
You can use like this
CurrentMail.Attachments.Where(Function(x) x.Name.Contains(”*.xlsx")).Count=1
If xlsx , it will go to then .
If not xlsx, it will go to else, you can add your further validation under else.
Thanks
Gokul001
(Gokul Balaji)
February 21, 2023, 7:32am
3
Hi @jai_kumar2
Can you please give a try on the below expression ?
CurrentMail.Attachments.Where (Function(x) Not (x.Name.Contains("*.xlsx"))).Count=1
Regards
Gokul
1 Like
Your condition is built the other way around:
Current LINQ → You’re checking if there is any attachment with .pdf as extension
LINQ that you want → Check if there is any attachment NOT having .xlsx as extension
for that I’d suggest trying the expression posted here by @Gokul001
1 Like
jai_kumar2
(jai kumar)
February 21, 2023, 8:52am
5
Hi thanks for teh reply
in outlook received mail have .xlsx format attachment but condition goes to else
what will be the possible reason for this
Hey
Try with
CurrentMail.Attachments.Where (Function(x) (x.Name.Contains(“*.xlsx”))).Count=1
In the then part make the process when the document is xlsx, in the else part do the process for rest type of documents
Regards
jai_kumar2
(jai kumar)
February 21, 2023, 8:56am
7
There is any possibility that, excel attachment format may not recoginized by bot
Gokul001
(Gokul Balaji)
February 21, 2023, 9:28am
8
Have you tried with this expression? @jai_kumar2
ppr
(Peter Preuss)
February 21, 2023, 9:44am
9
Kindly note:
LINQ, String method contains does not support the wildcard star
To robusten it up it can help to do a case insensitive check
maybe not an issue due minimal items count, but a where…count=1 construct is recommended to transform it to a where(…).Any() or Any( with LAMBDA) construct. We give therefore the option to stop, when a first item is found
In general we recommend to use the immediate panel for the direct prototyping:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
have a start with (checking all attachments if any non xlsx is present):
CurrentMail.Attachments.Where(Function(x) Not x.Name.ToUpper.EndsWith(".XLSX")).Any()
1 Like
system
(system)
Closed
February 24, 2023, 10:52am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.