none
Draft emails when converted to .msg does not contain 'To' field RRS feed

  • Question

  • when an email is saved as draft and converted to .msg file the .msg file does not have 'To' field.I used IconverterSession(MIMETMAPI()method.

    please help.

    thanks in advance.


    • Edited by D thopulou Friday, August 11, 2017 10:11 AM
    Friday, August 11, 2017 10:10 AM

All replies

  • Hello,

    The Outlook object model doesn't provide any converters. What converter are you talking about?

    If you speak about the IConverterSession::MIMEToMAPI method which converts a MIME stream to a MAPI message, it is not clear what parameters are passed.

    Anyway, take a look at the MFCMAPI source code. MFCMAPI uses MimeToMAPI to convert an EML file to a MAPI message. Does MFCMAPI work correctly?


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Friday, August 11, 2017 1:44 PM
  • I cannot reproduce this behavior in OutlookSpy (click IConverterSession | MAPIToMIMEStm). Is that what you are using? MIMEToMAPI is for *importing* a MIME message.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Friday, August 11, 2017 8:11 PM
  • Also don't forget to call IConverterSession.SetAdrBook() first to make sure IConverterSession has access to the IAddrBook interface.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, August 11, 2017 8:12 PM
  • thank you so much @Eugene Astafiev for your quick response.yes we are using IConverterSession::MIMEToMAPI. i convert .eml file to .msg using MFCMAPI and it does not contain 'to' filed. it only happens with the emails in draft folder.
    Monday, August 14, 2017 5:11 AM
  • thank you so much @Dmitry Strblechenko for the response i will do what you said and i will come back to you guys.

    thanks again

    Monday, August 14, 2017 5:32 AM
  • the parameters that i passed 

    MIMEToMAPI ( LPSTREAM pstm, LPMESSAGE pmsg, LPCSTR pszSrcSrv, ULONG ulFlags );

    with the ulflags CCSF_SMTP, CCSF_INCLUDE_BCC, CCSF_USE_RTF


    Monday, August 14, 2017 9:51 AM
  • Hi,

    Since your issues is complicated, 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! 

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 29, 2017 9:59 AM
    Moderator
  • Thank you so much Celeste for looking into my issue.
    Tuesday, October 10, 2017 10:19 AM
  • this is the corresponding MIMI content(base64) when decoded to it does have "To" Field but when imported to a folder using mfcmapi "To" filed is lost.

    UmVjZWl2ZWQ6IGZyb20gV0NTRVhDSC53Y3NkZXYubmV0ICgxMC44LjIxMC4xMTMpIGJ5IFdDU0VYQ0gud2NzZGV2Lm5ldA0KICgxMC44LjIxMC4xMTMpIHdpdGggTWljcm9zb2Z0IFNNVFAgU2VydmVyIChUTFMpIGlkIDE1LjAuODQ3LjMyIHZpYSBNYWlsYm94DQogVHJhbnNwb3J0OyBUdWUsIDEwIE9jdCAyMDE3IDE0OjExOjQ4ICswNTMwDQpSZWNlaXZlZDogZnJvbSBXQ1NFWENILndjc2Rldi5uZXQgKDEwLjguMjEwLjExMykgYnkgV0NTRVhDSC53Y3NkZXYubmV0DQogKDEwLjguMjEwLjExMykgd2l0aCBNaWNyb3NvZnQgU01UUCBTZXJ2ZXIgKFRMUykgaWQgMTUuMC44NDcuMzI7IFR1ZSwgMTAgT2N0DQogMjAxNyAxNDoxMTo0NyArMDUzMA0KUmVjZWl2ZWQ6IGZyb20gV0NTRVhDSC53Y3NkZXYubmV0IChbOjoxXSkgYnkgV0NTRVhDSC53Y3NkZXYubmV0IChbOjoxXSkgd2l0aA0KIG1hcGkgaWQgMTUuMDAuMDg0Ny4wMzA7IFR1ZSwgMTAgT2N0IDIwMTcgMTQ6MTE6NDcgKzA1MzANCkZyb206IFRob3B1bG91IDxUaG9wdWxvdUB3Y3NkZXYubmV0Pg0KVG86IFRob3B1bG91IDxUaG9wdWxvdUB3Y3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AvPg0KPC9vOnNoYXBlbGF5b3V0PjwveG1sPjwhW2VuZGlmXS0tPg0KPC9oZWFkPg0KPGJvZHkgbGFuZz0iRU4tVVMiIGxpbms9IiMwNTYzQzEiIHZsaW5rPSIjOTU0RjcyIj4NCjxkaXYgY2xhc3M9IldvcmRTZWN0aW9uMSI+DQo8cCBjbGFzcz0iTXNvTm9ybWFsIj5Ob3JtYWwgbWVzc2FnZTxvOnA+PC9vOnA+PC9wPg0KPC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+DQoNCi0tXzAwMF8zYmRmOThjNGU1ZWE0Njg3OTVkMjZhMjc1OTVlYWYzMFdDU0VYQ0h3Y3NkZXZuZXRfLS0NCg==

     
    Tuesday, October 10, 2017 10:22 AM
  • I tried the same at my local test beds (Outlook 2013 & 2016) against Exchange mailbox. But i failed to repro the issue using latest MFCMAPI. 

    I have the following queries.

    (1) Does your Outlook is fully patched?
    (2) Please share it build number 
    (3) Do i need to follow any specific steps/environemnt to repro the issue? (4) Also you tried the steps thats shared above by Eugene & Dmitry?
    (5) Still can you repro the issue?
    (6) Does the issue happens for specific mailitem in drafts folder? 


    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Friday, October 20, 2017 5:47 PM
  • Hi DeVa,

    Thank you so much for looking into my issue.

    I am so sorry to reply you very late. 

    I am using office 365 ProPlus with build no.8625.2121. 

    I tried the steps shared by Dmitry and i can still reproduce the issue.

    It is not for a specific mailitem it happens for all draft mailitem.

    I cant reproduce this issue in MFCMAPI.

    I think it has to do with IConverterSession but i am not able figure out what i am missing in using  IConverterSession.

    below given code is how i use IConverterSession

    hrRetVal = CreateConverterSession(true);
    if (FAILED(hrRetVal))
    {
    Log.Add(_T("CMIMEToMSG.Translate_Standard: Failed to create converter session object. (0x%x)"), hrRetVal); break;
    }

    SmartStream spMIMEStream;
    hrRetVal = GetStreamFromMIME(sMIMEFilePath, spMIMEStream);
    if (FAILED(hrRetVal))
    {
    Log.Add(_T("CMIMEToMSG.Translate_Standard: Failed at GetStreamFromMIME. (0x%x)"), hrRetVal); break;
    }

    hrRetVal = m_spConverter->MIMEToMAPI(spMIMEStream.GetNonAddRefedInterface(), spMessage.GetNonAddRefedInterface(), NULL, CCSF_SMTP | CCSF_USE_RTF | CCSF_INCLUDE_BCC);
    if (FAILED(hrRetVal))
    {
    Log.Add(_T("CMIMEToMSG.Translate_Standard: Failed convert MIME to MAPI. (0x%x)"), hrRetVal); break;
    }

    hrRetVal = spMessage->SaveChanges(FORCE_SAVE|KEEP_OPEN_READWRITE);

    thank you

     

    Wednesday, November 22, 2017 9:27 AM
  • Do you call IConverterSession.SetAdrBook?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, November 23, 2017 9:19 PM
  • Thanks Dmitry for your reply

    In the previous release we were calling it but it didn't help. In the latest release we are not calling it. I will test it again by calling IConverterSession.SetAdrBook in the latest release. But to call IConverterSession.SetAdrBook we have to create MAPI session which is our concern.We don't want to log in to MAPI session because we have to set outlook profile for all of our customers.

    Friday, November 24, 2017 6:50 AM
  • Can you reproduce this behavior in OutlookSpy (click IConverterSession | MAPIToMIMEStm)?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, November 24, 2017 11:48 PM
  • Hi Dmitry,

    I cannot reproduce this issue in OutlookSpy. Can't find out what i am missing in converting MIME to MSG.

    can you please suggest me another alternatives to find out the problem?

    Thanks,

    thopulou

    Wednesday, December 6, 2017 10:54 AM
  • Are you calling IConverterSession.SetAdrBook?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, December 6, 2017 1:53 PM