The problem isn’t the expression, it’s that you only have designated the lower case extensions in the resulting filter and have not defined the filter properly.
If(currentOffice365Message.Attachments.Any(Function(x) path.GetExtension(x.Name).ToString.ToLower.Contains("pdf")),"*.pdf|*.PDF","*.xls|*.XLS|*.xlsx|*.XLSX")
