specifying filename to be saved through code - InfoPath Dev
in

InfoPath Dev

specifying filename to be saved through code

Last post 10-01-2005 12:37 AM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-29-2005 03:02 PM

    • Sumeet
    • Not Ranked
    • Joined on 08-25-2005
    • USA
    • Posts 12

    specifying filename to be saved through code

    Hi Guys,

    I have a fully trusted form published on a sharepoint site in which I have a unique number text field. When I press the submit button I want to be able to save the form back to the sharepoint site as unique number.xml.

    I tried using Environment.CurrentDirectory thinking that that would give me the path to the sharepoint site but since I guess that fully trusted forms are downloaded to the user machine, Environment.CurrentDirectory returns path to my desktop on the local machine. Could anybody tell me how I can do specify the file to be saved on the sharepoint site instead of locally through code.

    Thanks

    Sumeet
  • 09-29-2005 10:41 PM In reply to

    Re: specifying filename to be saved through code

    Hi Sumeet,

    You don't need full trust for this. Submit will do and you can change the filename.

    Ciao,

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-30-2005 08:38 AM In reply to

    • Sumeet
    • Not Ranked
    • Joined on 08-25-2005
    • USA
    • Posts 12

    Re: specifying filename to be saved through code

    Hi Patrick,

    I need full trust since I have quite a bit of code associated with the infopath form so I am going to have full trust no matter what. What I need to know is that when you have full-trust how you can specify the name of the file to be saved back to the sharepoint site and not to your local machine.

    Since thisXDocument.SaveAs has to have an absolute path and not a relative path, I need to get the path to the sharepoint site.

    For the time being I have taken out this functionality and do this instead thisXDocument.View.Window.Close(false) which opens up the saveas dialogue box where there is the path to the sharepoint site. I just wanted to ask if its there, then there must be a way to get to it but how to get to the path?

    Your help is greatly appreciated,

    Thanks

    Sumeet
  • 10-01-2005 12:37 AM In reply to

    Re: specifying filename to be saved through code

    Hi Sumeet,
    Your workaround is strange. The SharePoint submit adapter gives you the ability to change the file name. Do you have a data adapter for your SharePoint submits? There is code in Chapter 10 of our book on how to modify the submit stuff.

    Here's the general idea:

    try
    {
    DAVAdapter oSharePoint = (DAVAdapter)thisXDocument.DataAdapters["SharePoint Submit"];
    oSharePoint.FileName = sSharePointFileName;
    oSharePoint.FolderURL = sSharePointFolder;
    oSharePoint.Submit();
    }
    catch(Exception ex)
    {
    ...
    }



    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.