Exception 0x80040119 “The items were copied instead of moved because the original items cannot be deleted. Unknown error” when moving mailitem RRS feed

  • Question

  • I have an Outlook 2013 add-in that hooks on the mail open event and processes emails before displaying the content to the user. I need to make a copy of the email for processing but I get the exception 0x80040119 “The items were copied instead of moved because the original items cannot be deleted. Unknown error” for emails that are not cached on the local .ost. Some old emails are not cached because Outlook 2013 has a new feature where users can choose how much email is downloaded to the local .ost cache for offline viewing.

    Here’s how to replicate the issue:

    Step 1: Set .ost file to only cache emails from a fixed period of time e.g. 12 months

    File > Account Settings > Account Settings… > Double-click on E-mail account > Check “Use Cached Exchange Mode” > For “Mail to keep offline”, select 12 months. The problem occurs for any value except “Any”.

    Step 2: In inbox view, search for an email that is more than 12 months old by typing in the subject and then clicking on “Find more on the server”.

    Step 3: Double-click on the email to open. At this point, the MailItem.Open event will be called and my add-in does the following:

    Outlook.MailItem mail1 = mail.Copy() as Outlook.MailItem;
    Outlook.MailItem mail2 = mail1.Move(destinationFolder);

    Line 2 fails with the exception 0x80040119 “The items were copied instead of moved because the original items cannot be deleted. Unknown error”. Mail2 is null and never assigned to any mailitem.

    Since mail2 is null, I cannot perform any further processing. Any suggestions on how to perform this copy action successfully?


    I have created a simple add-in that replicates the problem as follows:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using Office = Microsoft.Office.Core;
    using System.Windows.Forms;
    namespace OutlookAddIn1
        public partial class ThisAddIn
            Outlook.Application m_App = null;
            private Outlook.Inspectors m_Inspectors;
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
                m_App = this.Application;
                m_Inspectors = m_App.Inspectors;
                m_Inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            private void Inspectors_NewInspector(Outlook.Inspector Inspector)
                    if (Inspector.CurrentItem != null)
                        Outlook.MailItem mail = Inspector.CurrentItem;
                        Outlook.MailItem mail1 = mail.Copy() as Outlook.MailItem;
                        Outlook.MAPIFolder destinationFolder = mail.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
                        Outlook.MailItem mail2 = mail1.Move(destinationFolder);//this line fails                  
                catch (Exception e)
            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            #region VSTO generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);

    • Edited by Kuruda Wednesday, September 3, 2014 9:52 AM Added source code
    Wednesday, September 3, 2014 7:49 AM

All replies

  • Hello Kuruda,

    Do you have any other code in the add-in running? For example, subscribe to the item events and etc.

    It seems you get the COMException in the code. Am I right?

    Make sure that you released all the underlying COM objects that are related to the moved item before calling the Move method. Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. You can read more about this in the Systematically Releasing Objects article in MSDN.

    Wednesday, September 3, 2014 9:02 AM
  • Hi Eugene,

    Thanks for the prompt response! I created a simple add-in that replicates the problem and added the source to my original question for reference.

    I do not have any other code in the add-in running and yes, the COMException is caught by my try-catch block.

    The issue does not occur when the email being opened is already in the .ost file so I think it is unlikely to be due to not releasing COM objects. Did you mean to release the variable "mail"?

    Wednesday, September 3, 2014 9:59 AM
  • Nope. I'd suggest opening a support case in that case. It looks like a bug.

    Wednesday, September 3, 2014 1:01 PM
  • It appears that you're trying to make the copy in the NewInspector() handler. At that time the item in the Inspector is only a weak object reference.

    Have you tried waiting until the first Activate() event for the Inspector to try your move? Another possibility would be to handle the Open() event for the Inspector.CurrentItem and try the move there.

    Ken Slovak MVP - Outlook

    Wednesday, September 3, 2014 2:41 PM
  • Hi Ken,

    I've tried performing the move in the Activate and Open events but the exception still occurs for both cases. I did them separately to be sure.

    The following are the lines I added in the Inspectors_NewInspector function:

    ((Outlook.ItemEvents_10_Event)mail).Open += 
    	new Outlook.ItemEvents_10_OpenEventHandler(Mail_Open);
    ((Outlook.InspectorEvents_10_Event)Inspector).Activate += 
    	new Outlook.InspectorEvents_10_ActivateEventHandler(Activate);

    Thursday, September 4, 2014 1:24 AM
  • I don't think that the issue is related to the NewInspector event, so I didn't mention this.

    Did you have a chance to submit a bug / open a support case?

    Thursday, September 4, 2014 6:09 AM
  • I'd try on more thing before filing a bug on this. When you copy the item try grabbing the EntryID, then release it and try getting the item again before the move:

                     Outlook.MailItem mail = Inspector.CurrentItem;
    Outlook.MailItem mail1 = mail.Copy() as Outlook.MailItem;

                     string id = mail1.EntryID;


                      Outlook.NameSpace ns = Application.GetNameSpace("MAPI");

                     Outlook.MailItem m1 = ns.GetItemFromID(id);
    Outlook.MAPIFolder destinationFolder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
    Outlook.MailItem mail2 = m1.Move(destinationFolder);

    See if that helps at all. If not I'd recommend filing a support case.

    Ken Slovak MVP - Outlook

    Thursday, September 4, 2014 3:07 PM
  • Hi Ken,

    I tried the code you posted but now I get this COMException at the last line during the move:

    Exception from HRESULT: 0x8004010F, which I think represents MAPI_E_NOT_FOUND.

    Thanks Eugene and Ken. I guess I'll go ahead and file a support case with my local MS rep.

    Friday, September 5, 2014 2:15 AM
  • Hi Kuruda,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 10, 2014 10:07 AM
  • Hi,

    We are not able to reproduce the issue using the sample code shared by you in our test environment.

    Are you running latest build for Outlook 2013? if not, then please install the latest updates for Outlook 2013 @ and share your findings post it with us.



    Monday, September 22, 2014 9:21 PM
  • Hi Brijs,

    I installed the latest hotfix that you mentioned and the problem still persists. My Outlook 2013 version is 15.0.4649.1000 MSO (15.0.4569.1506) 32-bit.

    The issue only occurs for emails that are older than the cache-window. i.e. if you select 12 months of emails for caching, only emails older than 12 months will be affected. Perhaps the emails were already cached before you adjusted the cache-window?

    Wednesday, September 24, 2014 3:20 AM
  • Hi Kuruda,

    We are unable to repro the issue locally. As, this issue requires a more in-depth level of support and on-going troubleshooting effort. I would appreciate if you could open a new paid support request for it.

    Please visit the link below to see the various paid support options that are available to better meet your needs.;en-us;offerprophone



    Wednesday, October 15, 2014 8:20 PM