I am using an addin which enable me to attach a context menu to outlook attachments. So when ever I click on an attachment I am able to see my custom button in the context menu .
The problem I am facing is, how do I know which attachment is clicked. I have some alternatives in my mind
When context menu is opening, I can associate a tag to this context menu. In this tag , i can store the file name of the attachment. Using this file name I can identify the attachment in context_menu_button_click event. Currently I cannot find a place where context menu tells about the object, on which context menu was opened.
I loop through some property available in inspector or any other object which tell me which object, inside the email is selected. For this, I can get to the selected email and I can also iterate through all attachments, but I cannot figure out which attachment is selected (or right clicked)
Thanks to this SO post
var attachmentSelection = (control.Context as AttachmentSelection).OfType<Attachment>();
Which can be translated into...
AttachmentSelection attachmentSelection = control.Context as AttachmentSelection;
Now using attachmentSelection object may solve the problem....!
Use Explorer/Inspector.AttachmentSelection collection.
Related
I am checking PidlidPrivate property in MAPI.
Based on https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidprivate-canonical-property, this property can hide the message.
So I use MFCMAPI to set the value of PidlidPrivate property to True. But that does not work. The message will always show.
I test in Outlook 2019.
No, the message will not be hidden. It is only applicable to appointments from other user's calendars - if an appointment is marked as private, Outlook won't show its details (only start/duration). All of its properties are still accessible through MAPI.
If you want a message to be invisible to an end user, create a hidden (associated) item. Outlook Object Model exposes messages like that through MAPIFolder.GetStorage. You can see these messages in OutlookSpy (I am its author) if you click IMAPIFolder button and go to the "Associated Contents" tab. It will also let you edit MAPI properties (click IMessage button, double click on a property, etc.)
Globals.ThisAddIn.Application.Explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(DoNewExplorer);
I am trying to get the information from an email that I previously opened (by double-clicking) in outlook.
The code works fine until I open multiple emails. What I am finding is that when I click on an email, the inspector activates, but I am getting the information from the last active window, not the current one that I clicked on.
In the Activate event handler you can always call the ActiveInspector method of the Outlook Application class.
Note, the Inspectors collection contains all opened inspector windows, so you could get all of them or find the required one.
Firstly, your code tracks the Explorers.NewExplorer event, not Inspectors.NewInspector.
Secondly, for the Inspectors.NewInspector event, make sure you are using the Inspector object passed to your event handler rather than Application.ActiveInspector: by the time Inspectors.NewInspector event fires, the inspector might not yet be visible/active.
inside a Outlook COM Add-in (C#) I was able to retrieve all selected mails inside Outlook like this
var selection = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
List<Outlook.MailItem> outlookMailList = new List<Outlook.MailItem>();
foreach (object mail in selection)
outlookMailList.Add((Outlook.MailItem)mail);
to store the selected mails with some meta data inside a DMS.
Now I would like to do the same with the Javascript API for Office (office.js).
What is the correct entry point here? Because when I select more than one mail inside Outlook the OutlookTab-buttons inside the default ribbon get deactivated.
see also http://bettersolutions.com/javascript-api/hosts/extensionpoint.htm
For retrieving the mail information I have found
selectedMail = Office.context.mailbox.item;
How can I get now the data for all marked mails in Outlook. I expected to have something like
selectedMails = Office.context.mailbox.items;
// OR
selectedMails = Office.context.mailbox.selectedItems;
Does someone know how to retrieve the information which mails were selected to the TaskPane or maybe a CustomPane? Respectively if it is even possible?
Thanks a lot.
Unfortunately Office JS API built for handling a single item. Handling multiple items is not possible.
If this is a new feature you want to include in the future, you may submit a feedback.
https://officespdev.uservoice.com/
Best regards
I'm developping an outlook addIn using C# and I need to get attachment id from redemption or RDO MAil.
how's that?
Thank you
Outlook attachments (unlike messages) do not have unique ids since they only exist in the context of their parent messages.
PR_ATTACH_NUM property is used to open attachments - http://msdn.microsoft.com/en-us/library/office/cc841969.aspx.
But that property is not guaranteed to stay the same when a message is opened. More than that, the value of the PR_ATTACH_NUM property can differ depending on whether you retrieve it from the attachment table or from the attachment itself. Below is example from OutlookSpy (I am its author):
What exactly are you trying to do?
I was trying to replace attachment with a link in async callback method and I needed to detect which attachment to replace.
I used as flag the contentID of the Interop.Redemption.RDOAttachment Object and it worked fine, Thank you .
Problem : I am not able to find a solution to add a custom form field in outlook new mail window. I am using NetOffice and so far I have implemented to use user accounts from outlook.
Required guidance as how to add a custom drop-down button with custom text right under the send mail button.
Thanks in advance.
Cheers!
Farhan
I believe that in net office you need to declare a variable to the MAPI folder relevant to the form you want to start altering, and then go through the folder's View collection. A good start that was done in VBA can be found here:
http://www.vbforums.com/showthread.php?492714-RESOLVED-Outlook-Programmatically-add-user-defined-field
This link detailed the making of a custom field, and then adding it to the appropriate folder view default form. You can easily adapt the VBA code in the above link to NetOffice, since it uses the same methods step-through, such as
dim _outlookapplication as Outlook.Application
dim olNamespace as Outlook._Namespace = _outlookapplication.GetNameSpace("MAPI")
dim olFolder as Outlook.Folder = olNamespace.GetDefaultFolder(olDefaultFolders.olFolderContacts)
dim olView as Outlook.View
Good luck!