Redemption updating Outlook appointment potentially causing Outlook save error - outlook

I have an application that syncs appointments between Outlook and my application. The syncing code uses Redemption to update the appointments in Outlook.
When an appointment is added in Outlook, my code catches the item added event, generates an equivalent appointment in my application, and adds my appointment ID as a user property in the Outlook appointment then saves it.
The strange problem I'm having is this:
Single click on a day in the month view
Text box shows in the day block, type in the subject, then hit Enter
Double click the new appointment to open it right away
Make some changes such as setting a reminder
Hit save button
At this point, the Outlook will show me a message box saying "The item cannot be saved because it was changed by another user or in another window."
I find this happening quite often if I have my appointment syncing add-in enabled, but never happens if I disable it.
It almost looks like Outlook detects the change of my code saving the user property via Redemption and doesn't like it.
Is this because Redemption is accessing to the MAPI table directly to save the data, while Outlook still caches the appointment COM object when I open it too quickly. So that the appointment I opened is "outdated" by the time I want to save it again?
The Outlook version I'm testing against is Outlook 2016.

This error is returned if the following happens:
Your code (or Outlook) opens the item
Redemption opens the item
Redemption modifies the item
Redemption saves it
Outlook (or your code) modifies and saves the Outlook item
You can either make sure Outlook does not open the item in #1 or (if it is already opened) you can piggyback on the Outlook item and open it using RDOSession.GetRDOObjectfromOutlookObject at step #2.

Related

Open Task pane from command in Outlook add-in using Office.js

I am working on an outlook add-in and I need the ability to open a task pane from one of the button commands.
Long story short the command will reach out to an API. The result of the API call will let the client side know if any user interaction is required. If it is I want to present the user with the task pane to fill in any required information.
From what I have found you should be able to call Office.addin.showAsTaskpane().
However this only works if you are using the Shared runtime requirement set which is only supported in Powerpoint, Word, and Excel.
In Outlook you can open a task pane by clicking on the ribbon button or notification item which can be added programmatically, i.e. dynamically. So, you may consider adding a notification item with a link for opening a task pane as a possible workaround. However, it requires a user interaction.
Web add-ins don't provide any way in Outlook to open a task pane programmatically. You can file a new feature request at https://aka.ms/M365dev-suggestions .
This is not supported yet
You can refer from here Duplicate question OR similar
Thanks

VSTO Addin, AppointmentItem How to Save without Sending an update to recipients

I have a case where I want to save some UserProperties to the AppointmentItem but (if there are any recipients) it pops up an outlook dialog to Send it first.
How can I prevent this dialog. Even I do have recipients I should be able to save the AppointmentItem but apparently outlook doesn't saving without sending an update.
On the other hand calling Send on an AppointmentItem closes the explorer window and I couldn't find how to prevent that too.
appointmentItem.UserProperties.Add("LastUpdated", OlUserPropertyType.olText, true);
appointmentItem.UserProperties["LastUpdated"].Value = DateTime.Now.ToString();
appointmentItem.Save(); // This line shows the prompt

Getting MAPI_E_COMPUTED when altering PidTagBlockStatus in OutlookSpy

I have .MSG file for which I cannot change PR_BLOCK_STATUS (PidTagBlockStatus). If I change it with OutlookSpy or MFCMapi, I'm getting MAPI_E_COMPUTED.
Outlook also displays an error when saving this message (it happens after the user clicks Display external images, then closes the message, Outlook displays "Save changes?" dialog and the user agrees).
However, PidTagBlockStatus is not a computable property. I can't understand why this happens. I have another .MSG file which is almost the copy of the first one (OutlookSpy and MFCMapi show that both .MSG files have identical fields/values) but for this file I can set PR_BLOCK_STATUS. However, these files have different length and low-level utils like SSView show that larger (and "working") file has more fields. These mysterious fields, however, are not displayed in OutlookSpy or MFCMapi.
The problem is not related to incorrect setting of PidTagMessageDeliveryTime as both messages (working and non-working) have the same PidTagMessageDeliveryTime (and other fields as well). Outlook itself (which knows how to properly set PR_BLOCK_STATUS from PidTagMessageDeliveryTime) cannot complete message save operation.
"Working" file was saved directly from Outlook, "non-working" - with a third-party software. I need to find a way to "fix" the non-working file to make it possible for Outlook to save PR_BLOCK_STATUS without issues.
One more thing. It's possible to simply delete PR_BLOCK_STATUS from .MSG at all. This, however, has an effect that once the user clicked Display external images, Outlook correctly sets PR_BLOCK_STATUS but the message gets blank in Outlook until it's opened next time. So this method does not work for me either. For that, I'm adding PR_BLOCK_STATUS to the message and setting it to zero (letting Outlook calculate the correct value if the user decided to display external pictures). With the default value of zero, Outlook normally shows the message after "Display external images" click, but fails to update the .MSG file on closing the message.
Another method would be calculation of PR_BLOCK_STATUS in "show external images" state in advance (like it's described at html email outlook asks to download images topic), but I can't get this as this must be the user's decision for each particular message, not mine.
Links to .MSG files (good/working and bad/non-working)
https://dl.dropboxusercontent.com/u/18102725/msgs.zip
Using Outlook 2010 64-bit, Windows 7 Ultimate, OutlookSpy 3.7 64-bit.
MSG files let you set any property, including PR_LAST_MODIFICATION_TIME or PR_ENTRYID. How does third party software create the MSG files? Have you looked at the MSG files using the OLE Storage viewers, such as Structured Storage Viewer (http://www.mitec.cz/ssv.html)?

Send an individual attachment from Outlook to OneNote

I frequently use the "Send to OneNote" button in MS Outlook to save emails and their attachments in my notebooks. This allows me to accumulate an array of different inputs (e.g. email, reports, estimates in spreadsheets, etc, etc - I'm preaching to the converted, I think).
Often, I'd like to move a single email attachment to a OneNote page. My process for this is:
open the email
save the attachment to the Desktop
open the desired destination page in OneNote
drag the file from the Desktop to the OneNote page
select the "Insert the file as printout so I can add notes to it" option
I do this to save only the attachment I need and avoid saving the contents of the email and all the other attachments.
Can I send an individual attachment directly from Outlook to a OneNote page?
Shortly after writing this question (actually, as I was writing the question!), I found an answer that works for me.
Click and drag the attachment filename from the Outlook email directly to a OneNote page. The file insert dialog then pops up allowing insertion of an icon or printout.

Outlook 2007 add-in - What event occurs when an user moves an email from a folder to another one?

I am writing an Outlook 2007 add-in. I would like to know what event occurs when user moves an email from a folder to another one (with drag and drop or with move to folder option). My application represents a spam filter, I have a Spam folder, and I need to know whenever user moves an email form inbox to spam or form spam to inbox (this means for me that the email was wrong classified and I have to retrain it).
Thanks
Install the tool Outlook Spy then try out your experiment and see what events Outlook fires under the hood
how about Folder.BeforeItemMove?
Spambayes is a popular Open Source spam filter, which works exactly the way you describe - have a look at how it does it.

Resources