Accessing Intro field in MailEnvelope object - InfoPath Dev
in

InfoPath Dev

Accessing Intro field in MailEnvelope object

Last post 09-22-2006 10:29 AM by mbenbow. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-22-2006 09:28 AM

    • dloeffl
    • Not Ranked
    • Joined on 09-14-2006
    • USA
    • Posts 3

    Accessing Intro field in MailEnvelope object

    I am trying to use some simple code to create an e-mail that users can send. I do not want the sending to be automatic because the process is not perfectly rigid. Here is the code:

    if(to!="" && subject!="")
    {
    var objEmail = Application.ActiveWindow.MailEnvelope;
    objEmail.To = to;
    objEmail.CC = cc;
    objEmail.Subject = subject;
    objEmail.Intro = intro;
    objEmail.Visible = true;
    }

    Using this method it does not appear that I can pre-populate the "Intro" field as I get a "Object doesn't support this property or method" error referring to the "objEmail.Intro = intro;" line. Does anyone know if this is possible and how it can be done?
  • 09-22-2006 10:29 AM In reply to

    Re: Accessing Intro field in MailEnvelope object

    Hey,

    The MailEnvelope object does not expose the Intro property. However, the EmailAdapter object does expose the Intro Property.
    You can access the EmailAdapter object via XDocument.DataAdapters("Name of data adapter")

    Alternatively, you can program directly to Outlook which will create an email message but not send it directly (but you can only attach a MHT version of the form in the email)....the following was written in VBScript:

    Sub CreateMailMsg(sTo, sCC, sBCC, sSubj, sBody, sAttachFile)
    'purpose creates an outlook message and attaches the MHT file created above
    'date 04/19/2006

    Dim objOlApp
    Dim objItm
    Set objOlApp = CreateObject("Outlook.Application")
    Set objItm = objOlApp.CreateItem(olMailItem)

    With objItm

    .To = sTo
    .CC = sCC
    .BCC = sBCC
    .Subject = sSubj
    .Body = sBody
    .Attachments.Add sAttachFile
    .Display

    End With

    End Sub

    Function CreateMHT(sFormNum)
    'purpose to create a MHT web file of the form with its data for the user
    'date 4/13/2006


    Dim wshShell,oFileSys, filePath, sFormFile, myDocs, sFile, sDate


    'unique name for file
    sDate = Year(Now) & Month(Now) & Day(Now) & "_" & Hour(Now) & Minute(Now) & Second(Now)
    sFile = sFormNum & "_" & sDate & ".mht"

    Set wshShell = Createobject("WScript.Shell")

    'path to user's data
    myDocs = wshShell.SpecialFolders("MyDocuments")
    filePath = myDocs & "\Forms\"

    'check if path file exists
    Set oFileSys = CreateObject("Scripting.FileSystemObject")

    If oFileSys.FolderExists(filePath) Then
    sFormFile = filePath & sFile
    Else
    sFormFile = myDocs & sFile
    End if

    'check to see if the file exists - if it does, overwrite it
    If oFileSys.FileExists(sFormFile) Then
    oFileSys.DeleteFile sFormFile, True
    end if

    'create the mht file - needs digital certificate to do this
    XDocument.View.Export sFormFile, "MHT"

    CreateMHT = sFormFile

    End Function

    Hope that helps!
    MB


Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.