Fetch all the mails from Mailbox including all the folders and subfolders - imap

I am using Chilkat .Net Assemblies to fetch mails from mailboxes. Can you please tell me how can I achieve below functionalities using Chilkat?
It is possible to fetch all the mails from specified folder of the mailbox like Inbox, Outbox, Drafts etc. Now I have certain folders in my mailbox. What I want is to fetch all the mails from all the mailbox folders in a single go. Meaning, I want to fetch mails from Inbox, Outbox, Draft etc. etc.Is there any way to achieve this functionality using Chilkat.
Secondly, I have a mailbox folder with some subfolders. How can I fetch mails from the subfolders by only specified parent folder. Meaning, I have mailbox folder "Personal" within this there are two folder named "Sales" and "Purchase". IMAP.SelectMailbox("Personal") will return all the mails in this folder. My question is, will it return all the mails from the folders "Sales" and "Purchase".
Thanks, I am looking forward to it.
Thanks in advance.

As arnt has already pointed out, you will need to write a loop to do what you want. The body of the loop will need to SELECT the folder and then you'll need to loop to fetch each message from said folder.
No. It will not fetch the messages of child folders.

Related

AIP Sensitivity Labels added via Power Automate

I am interested to know if its possible to apply a sensitivity label to a document received via an email and then save the document to a specific directory in one drive.
For example, lets say company xyz sends a mail with files attached that we must process, I would like the files to be removed from the mail, marked with a custom sensitivity label like xzy_secret and then store the file in a OneDrive folder called xyz_company
So all the files in that folder eventually are labelled as per the customer.
Does anyone know if this is possible? The idea is that we can then apply DLP to our customers files and ensure we can track them within the business.
Anyone have any ideas? Is there an API for doing this or a power automate method?
As far as I know, Send an email action (with power automate) does not support applying the sensitivity label to the email currently. Being said that, you may need to implement your needs through the Rest API, please check this article and see if it helps:
https://joannecklein.com/2019/05/06/setting-a-retention-label-in-sharepoint-from-microsoft-flow/

Attaching/uploading files to not-yet-saved Note - what is best strategy for this?

In my application, I have a textarea input where users can type a note.
When they click Save, there is an AJAX call to Web Api that saves the note to the database.
I would like for users to be able to attach multiple files to this note (Gmail style) before saving the Note. It would be nice if the upload could start as soon as attached, before saving the note.
What is the best strategy for this?
P.S. I can't use jQuery fineuploader plugin or anything like that because I need to give the files unique names on the server before uploading them to Azure.
Is what I'm trying to do possible, or do I have to make the whole 'Note' a normal form post instead of an API call?
Thanks!
This approach is file-based, but you can apply the same logic to Azure Blob Storage containers if you wish.
What I normally do is give the user a unique GUID when they GET the AddNote page. I create a folder called:
C:\TemporaryUploads\UNIQUE-USER-GUID\
Then any files the user uploads at this stage get assigned to this folder:
C:\TemporaryUploads\UNIQUE-USER-GUID\file1.txt
C:\TemporaryUploads\UNIQUE-USER-GUID\file2.txt
C:\TemporaryUploads\UNIQUE-USER-GUID\file3.txt
When the user does a POST and I have confirmed that all validation has passed, I simply copy the files to the completed folder, with the newly generated note ID:
C:\NodeUploads\Note-100001\file1.txt
Then delete the C:\TemporaryUploads\UNIQUE-USER-GUID folder
Cleaning Up
Now. That's all well and good for users who actually go ahead and save a note, but what about the ones who uploaded a file and closed the browser? There are two options at this stage:
Have a background service clean up these files on a scheduled basis. Daily, weekly, etc. This should be a job for Azure's Web Jobs
Clean up the old files via the web app each time a new note is saved. Not a great approach as you're doing File IO when there are potentially no files to delete
Building on RGraham's answer, here's another approach you could take:
Create a blob container for storing note attachments. Let's call it note-attachments.
When the user comes to the screen of creating a note, assign a GUID to the note.
When user uploads the file, you just prefix the file name with this note id. So if a user uploads a file say file1.txt, it gets saved into blob storage as note-attachments/{note id}/file1.txt.
Depending on your requirement, once you save the note, you may move this blob to another blob container or keep it here only. Since the blob has note id in its name, searching for attachments for a note is easy.
For uploading files, I would recommend doing it directly from the browser to blob storage making use of AJAX, CORS and Shared Access Signature. This way you will avoid data going through your servers. You may find these blog posts useful:
Revisiting Windows Azure Shared Access Signature
Windows Azure Storage and Cross-Origin Resource Sharing (CORS) – Lets Have Some Fun

How to check if Outlook has finished sending an email with an attachment?

Our Delphi application uses Outlook programmatic access when a user needs to send reports as PDF's to their customers. Normally there are no issues but there are a few reports where each customer gets their own copy and errors are being reported by Outlook when the number of customers is over 100.
We did track down the problem to Outlook not being able to create more than 100 temporary copies of the same attachment name, due to the auto-numbering it uses. This blog entry has a good example of the issue.
http://chentiangemalc.wordpress.com/2011/05/08/case-of-the-outlook-attachment-open-fail/
The preferred solution is to delete the files from the OutlookSecureTempFolder, however we can't do this during the processing as sometimes Outlook hasn't actually finished sending the email before we delete the temp file, which causes a similar error.
Is there a way to know, after you use .Send, when Outlook has actually sent the email and it is safe to delete the temp file? There does not seem to be any callback or event we can hook into.

Access Inbox items from the API?

Is there a way to access the items in a workspace's inbox via the API? I'm primarily interested in the unread count, but could make good use out of any unhidden items as well.
At the moment you can't do this with a simple API call.
You might be able to do it by pulling down all projects, and then pulling down all the tasks for each project, storing that in a local database, and then search for tasks with assignee_status set to "inbox" (https://asana.com/developers/api-reference/tasks). But that is probably not the answer you want!

Ideas for storing e-mail messages in a Delphi client server application

There are many suggestions here and there for storing e-mail messages. Somehow what I am doing is writing an Outlook addin to send emails from inbox/sent folders directly to my application.
So only what is really interesting is saved. And I decide where to save it.
Imagine this case:
I recieve an email from a customer. It's up to me to decide whether I should save it on the customer or on the order 24 that that customer did. So this is why I am doing the add in, and not some automatic storing of emails = noise after some time.
This said, how to store the emails? For the emails that I recieve or send through Outlook the idea could be save the whole file in a blob field (so the eml file), may be I can save also other info (like the subject) in another text field. But the problem comes when I write an email from my application.
In this case I am not generating an eml file, I send through MAPI data to Outlook to compose an email that I will send with Outlook (so in this case I cannot save the eml), or I directly send it with Indy. Also in this case I don't have the eml file...
One idea could be that the all the emails that I auto compose have a special flag that the Add in recognises and therefore when I send the mail it is stored back to the DB. So in this case I can save the eml also of the mails I sent from my application.
May you comment?
First you have to decide on on what information you want to store. The rest is just a means to get there.
One option is to store the .msg files (you have posted related questions suggesting you are no stranger to MAPI) in stead of .eml files. Using MAPI you can store the IMessage you created as a .msg file (with a bit of pain). However, not all mapi props will be set until the message actually is sent, you so might need to hook outlooks send items folders for that.
A much more straightforward solution would be to generate the .eml (or whatever textbased format you prefer) directly from the source. When sending, take your source data, generate the correct MAPI calls to outlook AND generate the .eml and store it directly into your database. When recieving, have Outlook save to .eml directly.
Personally, I wouldn't use .eml at all for storage. I would parse the data I'm particularly interested in (like to/from addresses) into separate columns. In the end, you are probably using your DB for data retrieval. Databases tend to do a better job when you don't store everything in a single memo/blob field. :)

Resources