@balanirmalkumar.s
What error are you getting pls share screenshot for more clarity,
Check this ,
If(currentOffice365Message.Attachments.Any(Function(x) System.Text.RegularExpressions.Regex.IsMatch(x.Name, “.pdf$”, System.Text.RegularExpressions.RegexOptions.IgnoreCase)), “.pdf”, “.xls”)