PidlidPrivate in MAPI will not hide the message - outlook

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.)

Related

Outlook not showing options to download media

In incoming mail of outlook, Images are not downloading automatically. I have tried to download it automatically through File > Options > Trust Center > Trust Center Settings. I have unchecked all things from there. But there is no success.
I had a "Click here to download media" option below the sender's profile icon. But somehow, I can't see that option also. I am not able to download media automatically.
I have also tried to move the sender to the safe sender list through junk mail settings. The sender is now on the safe sender list. But still, I am not able to download media automatically.
Is there any other way to download it automatically/manually?
If HTML references external images, the message must be stamped with a special property that cannot be transmitted and can only be set locally, either by the end user or programmatically (see PidTagBlockStatus).
Note that you cannot set PidTagBlockStatus property using OOM - it always truncates date/time values to the nearest minute and you will need the exact value of the PidTagMessageDeliveryTime MAPI property .
If using Redemption (I am its author) is an option, you can set set PidTagBlockStatus property using RDOMail.DownloadPictures property.

Outlook VSTO - ActiveInspector returns the incorrect contact window's information

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.

How do I replace a custom task pane in Outlook (VSTO)?

Background
Let's say I have a custom task pane like the one in the image below.
For my app, I only display this pane if the user is logged in (determined by the presence of a valid session token that was granted from an API endpoint), otherwise I display a log-in pane.
If the user leaves an inspector open when the session times out, I need to show a different task pane with a log in button. The user have many inspectors (and, therefore, many custom task panes) open at once.
I am planning to run a recursive method on a background thread about once per hour to check if the session is valid and, if not, swap any custom task panes that are displayed with a log-in pane.
Question
How do I accomplish a "swap" in each inspector the user has opened? Should I iterate all inspectors? If so, how do I access a collection of custom task panes within that inspector. Conversely, if I should iterate Globals.ThisAddIn.CustomTaskPanes, how do I identify the inspector it belongs to so that I can swap any visible custom task pane with my log-in pane?
Thanks in advance.
You need to keep a dictionary where the key will be an inspector object. So, that you can get access to the custom task pane easily.
InspectorWrapper inspectorWrapper = Globals.ThisAddIn.InspectorWrappers[inspector];
CustomTaskPane taskPane = inspectorWrapper.CustomTaskPane;
if (taskPane != null)
{
taskPane.Visible = false;
}
Take a look at the following articles for more information:
Walkthrough: Displaying Custom Task Panes with E-Mail Messages in Outlook
How to: Display Custom Task Panes with E-Mail Messages in Outlook

How to Override the OK button in Reminder notification

I use ScheduledActionService to create a reminder with Uri. I like to know:
1) It is possible override the ok button or to write some code in the OK button which shows inside the reminder notification that pop up when time is due?
2) How to change the project name that display inside this reminder notification?
Thanks.
1) No, reminder look is not possible to change. All reminders must be freely recognizable be a user.
2) You can change it in WMAppManifest.xml (Title="") or in project settings: Application - Deployment options - Title.

Get Selected attachment in outlook

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.

Resources