Dear Forum Members,
I have designed a workflow in which I am extracting the data from Gmail account and saving the attachment, and writing all the extracted data into excel. For eg. Excel file can contain, Name, emailid, body of email, Date and Attachment Name. So, bot will extract the data and write into excel. If it has attachment, it will write the name of the attachment in that column else, it will leave the field blank.
Now, my question is: My bot is extracting only first attachment name, but what if the mail has multiple attachments. Right now, I am using “CType(mail.Attachments.FirstOrDefault,Attachment).Name” , this code for getting the name of the first Attachment.
I have also tried “mailMessage.Attachments.Select(function(x) x.Name)”, this code for getting all the Attachment Names but this code is not extracting any value in the variable.
The attachments which are saving in a folder, I can not use Directory.Getfiles(foldername) because the folder can have previous files as well, so if I use this method so with each iteration, it will give the names of unwanted files as well. I want the bot should pick the filenames as the attachments got saved.
I want to get names of the attachments in a variable, whether it is single attachment or multiple attachments. How can I achieve this.
Any help will be appreciated. Thanks in advance.