How to change location of the file?

Hi All,
I am using this code to convert infopath view to html, everything working fine but i want to change the file location
public string ConvertViewToHtml()
try
byte[] sourceFile = null;
XPathNavigator root = MainDataSource.CreateNavigator();
//string myViewName = this.CurrentView.ViewInfo.Name.Replace(" ", string.Empty);
string myViewName = "Email";
string myViewXslFile = myViewName + ".xsl";
// Create the xsl transformer
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(ExtractFromPackage(myViewXslFile));
// Generate a temporary HTML file
string fileName = Guid.NewGuid().ToString() + ".htm";
string filePath = Path.Combine(Path.GetTempPath(), fileName);
using (XmlWriter writer = XmlWriter.Create(filePath))
// Convert the XML to HTML
transform.Transform(root, writer);
writer.Close();
// Return the HTML as a string
sourceFile = File.ReadAllBytes(filePath);
return System.Text.Encoding.UTF8.GetString(sourceFile);
catch (Exception ex)
return "<html><body>Unable to convert the view to HTML <p>" + ex.Message + "</p></body></html>";
By default file get stored in this location 'C:\Users\TEMP.EGA\AppData\Local\Temp\64aa2af2-4f7f-44e9-afdc-6783f7f4007d.htm'. But I want to store in different location. How to achieve
this? Thanks in advance!

Hi,
You can change the line of code below
string filePath = Path.Combine(Path.GetTempPath(), fileName);
to
string path= "c:\\temp";
string filePath = Path.Combine(path, fileName);
More information:
https://msdn.microsoft.com/en-us/library/fyy7a5kt(v=vs.110).aspx
Best Regards
Dennis Guo
TechNet Community Support

Similar Messages

  • How to change location for config files in WLS6.0 (like weblogic.home and weblogic.system.home in 5.1)

    Hi,
    I would like to point weblogic to a directory NOT under c:\bea\... for it's configuration.
    I used to do this on WLS 5.1 by setting:
    weblogic.home=/weblogic and weblogic.system.home=/projects/wlsconfig
    This way my config was NOT coupled to the weblogic install.
    I want to do the same thing, and have the config directory located in /projects/domainconfig
    for example.
    weblogic.system.home etc doesn't seem to do anything. The
    only variable that does anything is bea.home, but I need weblogic to find it's
    libs etc in /bea, but ONLY the config should be elsewhere.
    Any help would be great.
    Thanks,
    Dion

    From SP1 and beyond, you can use
    -Dweblogic.RootDirectory=<dirname>
    * The property for specifying configuration location:
    * The directory name of the domain from which to load the specified
    * configuration. The default is ".".
    * -Dweblogic.RootDirectory=<dirname>
    * The directory must exist.
    Dion Almaer wrote:
    Hi,
    I would like to point weblogic to a directory NOT under c:\bea\... for it's configuration.
    I used to do this on WLS 5.1 by setting:
    weblogic.home=/weblogic and weblogic.system.home=/projects/wlsconfig
    This way my config was NOT coupled to the weblogic install.
    I want to do the same thing, and have the config directory located in /projects/domainconfig
    for example.
    weblogic.system.home etc doesn't seem to do anything. The
    only variable that does anything is bea.home, but I need weblogic to find it's
    libs etc in /bea, but ONLY the config should be elsewhere.
    Any help would be great.
    Thanks,
    Dion[att1.html]

  • I have problem with Itunes losing where podcasts and some purchased music is located. Don't know how Itunes losing the locations of the files and I can't find the files on my hard drive. What can I do to stop Itunes losing location and restore my files?

    I have problem with Itunes losing where podcasts and some purchased music is located. Don't know how Itunes losing the locations of the files and I can't find the files on my hard drive. What can I do to stop Itunes losing location and restore my files?

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • How do I stop pop up that asks me, Do you want to save changes to doc... before closing? I have made no changes only printed the file. Using Adobe Reader DC, Windows 7 64 bit.

    How do I stop pop up that asks me, Do you want to save changes to doc... before closing? I have made no changes only printed the file. Using Adobe Reader DC, Windows 7 64 bit.
    This is very annoying and we need this stopped as we have made no changes to any of the adobe files. Please advise how to do this.
    Customer Service DCC

    I first tried the version without the deflated stream (so everything uncompressed) against the online repair tool to check/analyse it @ https://www.pdf-tools.com/osa/repair.aspx
    And it says no error found, but the reader still want to save it when closing so i still had no clue at this point.
    Fortunately, i finally found what was wrong with my generated PDF.
    In my xref table, each object reference was not end by a full EOL, i only did put a newline char.
    Now i have "carriage return" "newline" which is the full EOL and the reader is happy and close the file silently.
    As suspected i did not follow correctly the specs on xref table
    Now i'll go and figure what i did wrong with the deflate filter
    Thanks for your help.

  • Whenever I close down Photoshop CS5 I get the message: "Could not save Preferences because the file is locked or you do not have the necessary access privileges. Use the get info command in Finder to unlock the file or change permission on the file or enc

    Whenever I close down Photoshop CS5 I get the message: "Could not save Preferences because the file is locked or you do not have the necessary access privileges. Use the get info command in Finder to unlock the file or change permission on the file or enclosing folders." What on earth does it mean? How can I stop this message from appearing?

    See here:
    I cannot save recent images.

  • How do I empty all the files in the "Downloads" folder ?

    How do I empty all the files in the "Downloads" folder ? Can they all be deleted at once?

    PS: when you look into the menu bar commands by mouse, you may note
    there are keyboard shortcuts to perform the same tasks; such as they are.
    *Edit> Select all* = uses 'Command + A' keys to do this, without mouse/menu.
    And, it can be done quickly by keyboard. +(this will select all, for the next step)+
    You would have to select the folder to be edited; yet there also are other key
    board commands to select items, folders, applications, etc all without a mouse.
    Once you choose items in a folder or other location, you can then use a
    keyboard command to Move them to the Trash; from there, Empty Trash
    with a three-key command; all without use of the mouse.
    The keys to *Move to Trash* looks like it is 'Command + Delete'. Some key-
    boards have two marked delete keys, so you may have to try both. The
    +small delete key+ has an icon with right-facing x in a box.
    The three keys, to *Empty Trash* via keyboard instead of menu bar/mouse
    appear to be the combination of 'up-arrow, command, delete.'
    Understanding some of the iconography of symbols used to indicate function,
    or what keys to use, as indicated by icons instead of words, is not too hard.
    There are articles and web pages which show various keyboard shortcuts.
    Here's an example, from one of several I've bookmarked over a few years.
    This one has images and shows what the key shortcut symbols mean.
    • Mastering Keyboard Shortcuts: (from myfirstmac site)
    http://www.myfirstmac.com/index.php/mac/articles/mastering-keyboard-shortcuts
    • Mac OS X keyboard shortcuts:
    http://support.apple.com/kb/HT1343
    However, if you have anything you may want to keep before mass deleting, be
    sure to move it into another folder. +re: The docked folders in Leopard+ 10.5 have
    one .PDF in each, about each of the purposed folders. I haven't deleted mine yet.
    {And I've added another folder into the dock near the Trash for my own alias items
    and the original is on the hard disk drive (one user) or could be put into an account
    folder so it would not have permissions or privilege issues with a second account.}
    I'd thought about those 'keyboard symbols' after the first posting; but,
    had to take an elder parent on several errands that took quite awhile.
    PS: there probably are ways to use AppleScript and Automator to handle folder contents.
    Good luck & happy computing!

  • How to change location in iMessage?

    How To change locations in iMessage?

    If you have Location Services turned on in Setting then the iPod knows where you are.

  • How to change color in the title line?

    Hi experts, How to change color in the title line, i show an image for explained better
    !http://img688.imageshack.us/img688/9259/imagenjar.png!
    thanks

    in Views.css file
    file below object.and change border-color as you desired to reflect.
    .TitleTable {
         font-family: arial, helvetica, sans-serif;
         border-width: 0 0 4px 0;
         border-style: solid;
         border-color: #6666cc; ----> change here.
    hope this helps !
    -Niranjan K

  • How do I locate non picture files and location? I'm getting low memory and can't find word,PDF etc

    how do I locate non picture files and location? I'm getting low memory and can't find word,PDF etc

    iPads don't have a filesystem like a computer, Files of that nature must be associated with an App and reside inside that particular App's file space.  So the way to find them is to open the App that opens that file type and look in its file or document list for them.

  • Change location of sync file outlook

    I'd like to change the location of the file that is used by PCsync to synchronize outlook to my 6230i (file: PcSync2.SML.lml)
    There are no menu options in pcsync.
    regedit finds it at C:\Documents and Settings\\Application Data\Nokia\PCSync\SynchData\\PcSync2.SML.lml
    Changes with regedit have no effect: the changed (F0) entry is moved to F1, and a new F0 entry is created again with the -for me unwanted- location "Documents and settings" etc.
    I'm running XP service pack 2, pc suite 6.81.13.0

    I'm experiencing the same problem. We have just been given new phones, and the sync location is under 'Documents and Settings'on the 'C' drive of the PC.
    Local Company policy limits this profile to 30MB and although there is other stuff that I can remove, it took 7MB when first syncing and another 3mb on the 2nd time of syncing.
    At this rate, every 7 syncs, I'll have to delete the Nokia folder and start again.
    I would like to move it to my personal network drive (f)
    Any suggestions would be VERY greatfully received.
    Thanks
    SteveMessage Edited by steve700 on 13-Mar-2007
    09:57 AM

  • Whenever I try to upload a file, firefox stops responding as soon as I try to select the location of the file.

    Every time I try to upload a file, firefox stops responding when I try to select the location of the file. It happens in Internet Explorer as well. Any suggestions?

    It happens on all sites, this one included. The "file upload" window opens for me to select a file but before a list generates, firefox stops responding. It must be my computer, since it happens with internet explorer as well, but I don't know how to fix it.

  • I am running out of memory on my hard drive and need to delete files. How can I see all the files/applications on my hard drive so I can see what is taking up a lot of room?

    I am running out of memory on my hard drive and need to delete files. How can I see all the files/applications on my hard drive so I can see what is taking up a lot of room?
    Thanks!
    David

    Either of these should help.
    http://grandperspectiv.sourceforge.net/
    http://www.whatsizemac.com/
    Or search 'disk size' in the App Store.
    Be carefull with what you delete & have a backup BEFORE you start, you may also want to reboot to try to free any memory that may have been written to disk.

  • In R12 how to change concurrent output/log file name prefix?

    how to change concurrent output/log file name prefix?

    but i want to change change concurrent output/log file name prefix?You cannot, and I believe it is not supported for all concurrent requests -- Please log a SR to confirm this with Oracle support.
    Thanks,
    Hussein

  • How can I delete all the files in the Adobe CS4 Master Collection from my machine?

    How can I delete all the files in the Adobe CS4 Master Collection from my machine. I have tried Control Panel but it will not do anything, there are no error messages, it is like as if it is ignoring my instruction. Why should it be so difficult to delete programs one does not want. Any ideas please.

    Moved from Cloud forum to Downloading, Installing forum
    Try running the Adobe Cleaner Tool
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

  • Yours sincerely! I just bought a Sony DCR-SD1000 camera only when installing the cd drivers not supported by the operating system Machintosh. I've contacted the seller said the store did not provide for the apple os. How can I move all the files on the ca

    Yours sincerely! I just bought a Sony DCR-SD1000 camera only when installing the cd drivers not supported by the operating system Machintosh. I've contacted the seller said the store did not provide for the apple os. How can I move all the files on the camera the port out is to use a USB data cable to a laptop for my macbookpro can not read the contents of the file and the camera. I also want to use the lens on the camera as a substitute for the embedded camera on my macbookpro, what should I do to replace the embedded camera on macbookpro with sony camera so that the camera could be more variety and can I record when I turned macbookpro . Please help for this so that I can quickly capture the results from sony camera to my macbookpro. Thank you.

    See this page http://macosx.com/forums/networking-compatibility/296947-sony-camcorder-my-mac.h tml - might be some helpful tips there.
    Clinton

Maybe you are looking for