Saving Message Object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kannan

    Saving Message Object

    Hi,
    I am trying to save Inbox selected message in C:
    I have used following code

    string SavedMessage = "C:\\AIA\\Messa ge\\";
    string strSaveName = "Test.msg";
    Outlook._Applic ation olApp = new Outlook.Applica tionClass();
    Outlook._NameSp ace olNs = olApp.GetNamesp ace("MAPI");Out look.MAPIFolder
    oContacts = olApp.ActiveExp lorer().Current Folder;
    Object selObject = olApp.ActiveExp lorer().Selecti on[1];
    FileSystemObjec t fso = new Scripting.FileS ystemObjectClas s();
    //selObject.SaveA s strFolderPath & strSaveName, olMSG

    But I can't find SaveAs option in selObject property. What I am missing here.

    Thanks
    Kannan
  • Kannan

    #2
    RE: Saving Message Object

    Hi,
    I have changed this below code as follows

    string SavedMessage = "C:\\AIA\\Messa ge\\";
    string strSaveName = "Test.msg";
    Outlook._Applic ation olApp = new Outlook.Applica tionClass();
    Outlook._NameSp ace olNs = olApp.GetNamesp ace("MAPI");
    Outlook.MAPIFol der oContacts = olApp.ActiveExp lorer().Current Folder;
    Outlook.MailIte m selObject =
    (Outlook.MailIt em)olApp.Active Explorer().Sele ction[1];
    MessageBox.Show (selObject.Subj ect);
    //selObject.SaveA s("C:\\","Messa ge.msg");

    But when I try to call SaveAs method, it asked for one more parameter called
    object Type (ie selObject.SaveA s(Path,Type)). What value I have to pass it
    for Type parameter.

    Please help...

    thanks

    "Kannan" wrote:
    Hi,
    I am trying to save Inbox selected message in C:
    I have used following code
    >
    string SavedMessage = "C:\\AIA\\Messa ge\\";
    string strSaveName = "Test.msg";
    Outlook._Applic ation olApp = new Outlook.Applica tionClass();
    Outlook._NameSp ace olNs = olApp.GetNamesp ace("MAPI");Out look.MAPIFolder
    oContacts = olApp.ActiveExp lorer().Current Folder;
    Object selObject = olApp.ActiveExp lorer().Selecti on[1];
    FileSystemObjec t fso = new Scripting.FileS ystemObjectClas s();
    //selObject.SaveA s strFolderPath & strSaveName, olMSG
    >
    But I can't find SaveAs option in selObject property. What I am missing here.
    >
    Thanks
    Kannan

    Comment

    • Willy Denoyette [MVP]

      #3
      Re: Saving Message Object


      "Kannan" <Kannan@discuss ions.microsoft. comwrote in message
      news:A9D7FF5F-04DE-4661-ADC1-0B4455989405@mi crosoft.com...
      | Hi,
      | I am trying to save Inbox selected message in C:
      | I have used following code
      |
      | string SavedMessage = "C:\\AIA\\Messa ge\\";
      | string strSaveName = "Test.msg";
      | Outlook._Applic ation olApp = new Outlook.Applica tionClass();
      | Outlook._NameSp ace olNs = olApp.GetNamesp ace("MAPI");Out look.MAPIFolder
      | oContacts = olApp.ActiveExp lorer().Current Folder;
      | Object selObject = olApp.ActiveExp lorer().Selecti on[1];
      | FileSystemObjec t fso = new Scripting.FileS ystemObjectClas s();
      | //selObject.SaveA s strFolderPath & strSaveName, olMSG
      |
      | But I can't find SaveAs option in selObject property. What I am missing
      here.
      |
      | Thanks
      | Kannan

      Sorry, I don't want to sound harsh, but you are missing a lot.
      First, you need to understand the CLR's object model, so that you know that
      the CLR Object class doesn't implement a SaveAs method (I hope you
      understand that Object in .NET is not the same as Object in VBA).
      Second, you must understand the outlook object model, so you need to start
      by reading this: http://msdn2.microsoft.com/en-us/library/ms268893.aspx and
      this:
      http://msdn.microsoft.com/library/de...HV01136199.asp.

      You must also understand that .NET comes with a rich class library, so there
      is no need to use scripting objects like FileSystemObjec t, start by getting
      used to the FCL. And I would suggest you to start with VB.NET instead of C#,
      the language is better suited for this kind of tasks, especially when you
      come from a scripting environment like VBA and/or VBScript.

      Willy.


      Comment

      Working...