I need to download Outlook attachments to a folder and check if only .xlsx attachments are present. If there are attachments in any other extension, it should throw an exception.
Apparently it does not seem to identify .txt attachment and download it.
Apparently it does not read the ‘For Each item’ condition when I try to read the extension from the directory. This is what I am doing.
vFolder = the folder path
vDirectory = Directory.GetFiles(vFolder," ",SearchOption.AllDirectories)
For each item in vDirectory
if Path.GetExtension(item) = “.xlsx”
Then,
Save attachment
Else
Throw Exception
I just figured out that if the size of the attachement is 0 bytes, it does not detect the attachment. I typed “abc” into the .txt file, saved it and mailed it. The bot could then download the .txt. file.