Dataport Exporting into User's My Document Folder

veerendraveerendra Member Posts: 66
Hi Gurus,

I have to export data into the text file using Dataport and need to store that text file into the User's My Document Folder.
Any one help me to find the path (My Documents for Different User's).
Urgent... ](*,)
Thanks
Veerendra CH.
Veerendra Ch.
http://midynav.blogspot.com/ (Microsoft Dynamics Navision)

Comments

  • krikikriki Member, Moderator Posts: 9,118
    Try something like this:
    txtFullPath := ENVIRON('HOMEPATH') + '\My Documents\' + 'TheFile.txt';
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bbrownbbrown Member Posts: 3,268
    You can use the Windows enviroment variable USERPROFILE to find to the user's personal folder.
    There are no bugs - only undocumented features.
  • fufikkfufikk Member Posts: 104
    To get the user directory for examlple \Documents and Settings\{username}
    use env. variable HOMEPATH,

    to get drive letter for that dir use HOMEDIR.

    to get location of My documents dir, you'd have to look into registry:
    I think the key is:
    \HKEY_CURRENT_USER\software\microsoft\windows\currentversion\explorer\shell folders\personal

    Adding My Documents after HOMEPATH is not always correct, because user may change the location of My documents folder and in different win languages My documents is also translated.
  • veerendraveerendra Member Posts: 66
    Thanks to all,
    Its working Fine...
    I have used
    Path := ENVIRON('USERPROFILE') + '\My Documents\' + 'Textfile001.txt';
    =D>
    Veerendra Ch.
    http://midynav.blogspot.com/ (Microsoft Dynamics Navision)
  • kinekine Member Posts: 12,562
    Do not forget that not everywhere is the document folder named with "My Documents"... :-) best way will be to read the folder location from registry...

    see registry "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal"

    How to read from registry - search MIBUSO.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.