Outlook plugin - Fetch emails with specific message ids - vba

I am writing a plugin for Outlook, where I need to fetch only few emails based on some back end Logic.
I have stored those email Message Unique Ids in my DB. And on click of plugin Icon, I wish to load only those Emails to load in my Inbox.
Example, the logic is same as how we click on particular folder like sent items or unread items, it refreshes the Inbox with only the respective emails.
I have created a plugin icon following the tutorial:
https://learn.microsoft.com/en-us/outlook/add-ins/addin-tutorial
Using NodeJS for coding. Can you please give a pointer, how do we load emails in Inbox? or if we can load only specific emails in Inbox?

This is not possible if you're attempting to use the Outlook's inbox display module to show the items you're refreshing. You will have to open a dialog / or a new browser tab to show the custom list of items - which I think is not good user experience. As Brian called out, office-js add-ins are quite restricted.

Related

Programmatically move mail from Other to Focused inbox

I would like to move mail from Other to Focused Inbox programmatically or make whatever changes necessary in my new mail event handler so that the mail shows up in one on the other.
The reason I want to do this is because I want most of notification mails from a forum to be in the other inbox; except that when the Subject contains a certain string I want it to show up in the Focused Inbox.
The Manage Focused Inbox help page mentions Focused Inbox REST API and inferenceClassification property that controls but I do not know how to use that.
Is it possible to modify this property in VBA, or any way to move mails between the two inboxes programmatically?
I manually compared all items in MailItem.ItemProperties of a mail message when in Focused and Other Inbox. inferenceClassification is not one of the properties. The only properties with different values are LastModificationTime and strangely OutlookVersion, OutlookInternalVersion, and Size!
The Outlook object model doesn't provide any property or method for including/excluding items from the focused inbox list. But I think it may act like a search folder in Outlook. You just need to find out what is causing emails to appear on the list.
You can use MFCMAPI (open-source) or OutlookSpy (shareware) utilities for exploring hidden properties in Outlook to find out what properties could cause an email to appear in the focused inbox.

Outlook mail : option to change mail subject color using vsto

I have couple of doubts regarding Outlook addIns.
I created a ribbon for Outlook application using VSTO.
While sending the mail i call some API and make some db entries.
I keep the mail in inbox even after i sent the mail.
Now i need an option to change the color of that message subject (like indication this is already send. eg : unread mail subject is in bold )
Is there any way that i can achieve this ?
The ribbon i created is showing under Add-ins menu.
i wated to show this in Home itself.
I tried tab idMso="TabHome", TabMail etc but its not working (i am using office 2010)
You would need to modify the view setting based on some condition - look at an existing Outlook views that bold the unread messages and display overdue messages in red.

How to email dropbox app file paths as clickable hyperlinks?

The company uses dropbox instead of local servers. We often send files to colleagues, but each user has a unique path to the file stored in the dropbox desktop app (e.g. C:\Users\username\Dropbox...).
I was thinking about writing a batch script to copy a file path and strip the beginning of the path. I would then need another script to add the user specific prefix to the file path, and then open the folder/file in file explorer.
I believe I found a way to add a batch file into the menu that pops up when you right click a file/folder by editing the registry. I was thinking it would be possible to write an Outlook add-in for the receiving user to prepend their drive/username etc. to the file path and then open the file/file explorer if a path to a folder is sent.
I was hoping to get some input on this approach, or to know if there is an easier way to handle this. I haven't started any of the code yet.
Why don't you just start using the Dropbox add-in for Outlook?
Dropbox has created an add-in that integrates with Microsoft Outlook. By connecting the Dropbox add-in to your Outlook account, you can:
Replace email attachments with a shared link to any file, big or small
Save email attachments that you receive directly to your Dropbox account
Ensure those with access to a file see updates to it (since shared links always point to the latest version of a file, whereas attachments are just a static copy)
Enabling the integration adds a Dropbox icon to the Outlook compose window. When you click this icon a pop-up window appears, allowing you to select from the contents of your Dropbox. A shared link to any selected file or folder will appear in the body of the email.
While this link looks like an attachment, it's, in fact, a shared link. This means no slow-down in sending emails, and no space limitations in your inbox.
Anyway, if you still want to develop an add-in for extracting an attachment's file path you need to start with Walkthrough: Create your first VSTO Add-in for Outlook.
The NewMailEx event of the Application class which is fired once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem and etc. The EntryIDsCollection string contains the Entry ID that corresponds to that item.
The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item. Use this method with caution to minimize the impact on Outlook performance.

how to display some message once user starts to compose new email

For Office 365 Outlook Web App, we would like to convert attachments to links once end user uploads them, however we didn't see an attachment notification event at current Outlook Addin.
Another approach we could do is to ask them to use our own buttons for uploading, however we need to guide end user to use our own buttons, could we add some message at top of email body like below once new email message box is displayed?
Somehow based on our research, Outlook Addin only has one event right now which is SendEvent, could someone confirm this? if so, it is rather limited.
To display a custom message use Office.context.mailbox.item.notificationMessages object. For example to add a message to current item the code may looks like ...
Office.context.mailbox.item.notificationMessages.addAsync("information", {
type: "informationalMessage",
message : "My custom message.",
icon : "iconid",
persistent: false
});
Be aware there are a maximum of 5 notifications per message and maximum length of each message text is 150 characters per Office.NotificationMessageDetails interface.
For the secondary question you would need to look at available events in Office.EventType enum. Over here you'll see few events available to Outlook app. One of them you are interested in is AttachmentsChanged which is currently available only in Preview (not released yet, but will be soon).

VB Code to Close Open Subfolders in Outlook

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.