Alert me Export table data to .MSG file using Stored Procedures or any plugin ?

  • Is it possible with a stored procedure to write/export/output the data as .msg outlook file using existing table data?

  • May I ask what you are trying to achieve overall?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • sure, i have 3 tables with e-mail related columns which are being populated from outlook mail (from an outlook plugin).

    Now we have to export these table data and frame an output file stream as .msg file format in a storage disk.

  • without using .NET, then no, the specific file extension *.msg ends up requiring C# to do something like this, since the msg is a binary file:

    you could save as text or html easily, though.

    Microsoft.Office.Interop.Outlook.Application objOutlook = new Microsoft.Office.Interop.Outlook.Application();

    // Creating a new Outlook message from the Outlook Application instance
    Microsoft.Office.Interop.Outlook.MailItem msgInterop = (Microsoft.Office.Interop.Outlook.MailItem)(objOutlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));

    // Set recipient information
    msgInterop.To = "neha1@gmail.com";
    msgInterop.CC = "neha@gmail.com";

    // Set the message subject
    msgInterop.Subject = "Subject";

    // Set some HTML text in the HTML body
    msgInterop.HTMLBody = "

    HTML Heading 3

    <u>This is underlined text</u>";

    // Save the MSG file in local disk
    string strMsg = @"c:\\temp\TestInterop.msg";
    msgInterop.SaveAs(strMsg, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG);

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • But do take in consideration that the example that Lowel gave you requires Microsoft Office to be installed on the pc/server where it is executed - if on a server it is a break of licensing and is not supported by Microsoft.

    Most likely you can do what you desire using EWS (https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/explore-the-ews-managed-api-ews-and-web-services-in-exchange if you have an exchange server. without it I'm not sure if EWS will allow you to create messages.

     

    there are third party tools to create these - mostly paid - or if you are brave enough you can build one yourself as the file format is open https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxmsg/b046868c-9fbf-41ae-9ffb-8de2bd4eec82

     

     

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply