Options

How to retrieve network path from mapped drive path

GaryDGaryD Member Posts: 66
edited 2008-01-03 in NAV Tips & Tricks
Hello, using the CommonDialog control, I allow a user to select a file. Then I place that path and filename into a field of a table. Once the path is stored in the table, other users should be able to click a button on the form and open the designated file. The problem is that the path may be a mapped drive path and other users would not be able to access the file that way. Is there a way to retrieve the UNC path from the mapped drive path?

Thanks!

Comments

  • Options
    SavatageSavatage Member Posts: 7,142
    Even if it is saved on their c drive and it's not shared - I'm never going to be able to get. That's why long ago when we set up the network all the computers have the same mapped network drives (makes life alot easier)

    I (Navision Database)
    M (Crystal Reports)
    P (All Pictures)
    S (All Documents)
    Z (BackUp Files)
    etc...

    This way any path from one machine is the same for all.
    IMHO :D

    What are you looking for something like %ROOT%
  • Options
    ara3nara3n Member Posts: 9,255
    You can also store the file in the db as blob, depending on the size.

    Then you don't have to worry where it is stored because it'll will be always at the server.

    Also SQL 2K8 has this feature, and it can store files in separate folder on sql so they are not really stored in the db.

    I hope Navision implements this feature down the line.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    garakgarak Member Posts: 3,263
    After Saving the Path in an Field, you can get the Shared Name with following Source and save it into an other field. From other clients, you open the file with using Shared Name (UNC)

    ....
    use your code with openDialog
    ....
    now we will get the Shared Name
    variables:
    Name	DataType	Subtype	Length
    WSHDrive	Automation	'Windows Script Host Object Model'.Drive	
    WSHFSO	Automation	'Windows Script Host Object Model'.FileSystemObject	
    
    if isclear(WSHFSO) then
      create(WSHFSO);
    
    WSHDrive := WSHFSO.GetDrive('YOURDRIVELETTER'); //('Z:\')
    //Convert / add here '\'
    
    Rec.FieldShardName := WSHDrive.ShareName(); //(ComputernameOrIP\Folder\folder2\...)
    
    .....
    

    now you can open the file using SharedName. (User must have permissions to connect to the Computer / Folder)

    Regards
    Do you make it right, it works too!
  • Options
    GaryDGaryD Member Posts: 66
    Thanks garak. Just what I needed! And thanks to the other responders. This newbie appreciates it!
  • Options
    garakgarak Member Posts: 3,263
    Please
    Do you make it right, it works too!
  • Options
    krikikriki Member, Moderator Posts: 9,096
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.