I know I've seen this question before but I can't seem to find it again.
I want to use Microsoft Interop to copy a mail message from the inbox to a differnt folder. I know that other objects like appointment, and folder both have a CopyTo() method, but it is missing for MailItem. The way I do it now is call MailItem.Copy and then move the copy to another folder. I don't like this because it causes some "flicker" on the screen in outlook where you can see the Inbox grow and shrink as the emails are copied then moved.
Is there another solution?
Thanks
Sad but this is the only way...
Look at http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/3dd2bd06-5738-4fb2-b628-0d7ab2be8157/
Related
Recently I have written small tool (vb.net WinForms) for our company that creates structure and archives all Emails that are in x, y Folder in Outlook. This tool then renames and converts these .msg files to .eml files.
Now it would be perfect, if these Emails would automatically convert themself when user places it directly in the destination in Windows-Explorer folder per Drag and Drop. For that I assume I would have to run script/programm whenever Event X (moving Email from Outlook to explorer) occurs.
Has anyone an idea if catching that event would be possible? Or maybe any better ideas? I thought of some scripts that run on server and check for new files (once daily for example), but the first solution is more appearing to me.
You can catch the Items.ItemAdd event on the folder to track and convert new items.
The Outlook object model doesn't provide any events when items are saved to a folder by dragging and dropping items. You can use a file system watcher to track folder changes, see VBA monitor folder for new files for more information.
I was hoping to find a way to get an Outlook items collection for all items, regardless of what folder they may be sitting in so I can do a restrict on every item, no matter where someone may have moved it. Does anyone know if this is possible? I was poking around in the Outlook object model but I couldn't find anything.
You can use Application.AdavncedSearch to search the top level folder of the store including subfolders. Keep in mind that the search is asynchronous, so you will need to wait for the Application.AdvancedSearcvhComplete event to fire.
Am I able to use Outlook to automatically link a folder in outlook with a folder on the network drive?
Let's say I want to use VBA to modify a folder called "New York Store" within outlook. I would like to modify the folder, so whenever I put an email into this folder, it will save the email on a destination on the computer such as "X:\Stores\Outlook Archive\New York Store", and when it has done so, it permanent delete the email from Outlook?
Is it possible to modify a folder (by VBA or something else) to save the email(s) within a folder, and when it has done so, delete the emails from Outlook permanently?
Please let me know, if this is possible :)
To answer your question: Yes. It is possible. You'll need to brush up on programmatic folder control and find a way to "watch" the folder for new items.
Is there a reason that there has to be a folder involved? You'd save a few steps with something like a custom button on the Mail Item ribbon to save to file and delete message.
Or, considerably fewer keystrokes:
F12EnterDel
It will work on one or more items, no additional folder required, and after the first time you save an item at your location X:\Stores\Outlook Archive\New York Store it will default to that folder.
I have tried to find a script or rule which will let me copy all inbound messages to an archive folder and then mark the mail as unread.
Can anyone point me in the right direction, or help with a script please?
I can find plenty that will mark as read, but not as unread.
Thanks in advance, Neil
An outlook MailItem object has a property UnRead which you can toggle as boolean, either True (unread) or False (read).
Returns or sets a Boolean value that is True if the Outlook item has not been opened (read). Read/write.
and welcome to StackOverflow!
To achieve the result that you are looking for, it would be a simple Outlook Rule. Assuming that you are using Outlook 2013, you would just need to go to your Inbox, the select under the Home tab, Rules. Then create a new rule. Start from a blank rule with messages that you receive. Then click next. (Outlook will ask you whether you are sure if you want the rule to run on every email message, click yes) Then chack the box that states, "move a copy to the specified folder". That folder will be your archive. Then, if you would like to, you can choose whether you want a desktop alert for the email. There is no need to select an option of having the email unread, because the email by default is unread when copied to the archive.
I hope this helps.
As workaround you can create rule based on email size (with a size in a specific range). You can put 0 to 999999 and then move a copy to any folder. This should copy all your inbox emails to another folder.
Outlook has an habit of opening sub-folders if an email has been sent to it automatically (through rules). There is no way to turn off this feature.
Does anyone have ideas for code that would periodically (say every 30 seconds), automatically collapse all subfolders within, say, the sent items folder?
Thx
The Outlook object model doesn't provide anything for collapsing folders in the navigation pane.
The Starting Outlook with all folders collapsed/expanded states the following:
To keep the mailbox collapsed even when a new message is being delivered, make sure that your Inbox and other folders that receive email (for instance by a rule) have been added to your Favorites list.