email attachment file name - InfoPath Dev
in

InfoPath Dev

email attachment file name

Last post 12-20-2006 05:15 AM by Sam . 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-15-2006 12:18 PM

    email attachment file name

    I have a new hire form that gets updated by multiple departments from MIS, Purchasing, Hiring Mgr and so on. I want to know how we can save all filled out forms to a folder should we need to create report. Can someone tell me I can change the attachment to form1 to a more meaningful name. After submit it asked me to save the form in which I use the employee name for the file name. The employeeName.xml doesn't get updated when I tried to open the attachment on the email, it was using form1. Why save the xml file when you can't link to it for further updates?
  • 09-15-2006 09:17 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: email attachment file name

    Hi Cornik,

    Yes it is possible to send the URL in your mail.

    1. You need to go to Data Connection. In the Designer, go to Tools->Data Connections and click Add. Select Submit data and click Next. Select "As an e-mail message" and click next. A dialog will appear that has lines for To:, Cc:, Bcc:, Subject:, Intro, and form attachment. Click on the "fx" button next to the Subject: line and click Insert Field or Group. Select the Field from your main data source. Click OK. Which use the employee name for the file name field and specify others if you want. Click Next.

    2. Here is the code to send an email via code
    EmailAdapter oEmail = (EmailAdapter)thisXDocument.DataAdapters["Email Submit"];
    oEmail.To = "[email protected]; [email protected]";
    oEmail.CC = "[email protected]";
    oEmail.Subject = "employeeName.xml";
    oEmail.Intro = "Intro";
    oEmail.Submit();

    Note: Above code is in c#
  • 09-28-2006 02:49 PM In reply to

    Re: email attachment file name

    Thanks Shiva. But can you please tell me how to code to create the url link. Should I first save the file to a folder first and then create the link to the saved xml file? How do I do it all in codes?
  • 09-29-2006 12:22 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: email attachment file name

    Hi Cornik,

    If you are saving those xml files to share point then you can get the Share point Folder path and File Name as below the code.

    Private string GetSharepointFolderPath()
    {
    string solutionUri = thisXDocument.Solution.URI;
    int position = solutionUri.LastIndexOf("/Forms/");
    if(position == -1)
    {
    return "";
    }
    position = solutionUri.LastIndexOf("/", position - 1);
    return position == -1 ? "" : solutionUri.Substring(0, position + 1);
    }

    private string FileName()
    {
    string uri = thisXDocument.URI;
    int position = uri.LastIndexOf("/");
    string fileName = uri.Substring(position + 1);
    return fileName;
    }

    These methods return the share point library path and file name of the xml. If you are saving in local folder then you need to specify the where you are going to save the xml file path in code.

    Note: The above code in C#.
  • 12-20-2006 05:15 AM In reply to

    • Sam
    • Top 500 Contributor
    • Joined on 11-27-2006
    • California
    • Posts 44

    Re: email attachment file name

    Hi,

    I have used the above code to find a the SP document library path and the file name i want to attach with my current form.
    Sorry but am i suppose to replace Forms in ( solutionUri.LastIndexOf("/Forms/");) with my docuemnt library path name which ends with .aspx.

    Where else am i supposed to make changes.

    I have a form where i want to be able to find and attach any form from my document library and use email submit(figured this one by code)to send my form.

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