How do I save a file over the UNC Path?

Posted on 2007-10-15
Last Modified: 2008-01-09
I want to save a Stringlist to a File with the UNC-Filename, without mapping the Ressource, in Delphi.

Question by:samurai34
    LVL 17

    Accepted Solution

    okm the obvious bits are
      sl: tstringlist;

    if you do not have access (requires auth) then I think it's
     WMNetAddConnection or  WMNetAddConnection2 or something like that...
    you do not need to provide a drive letter for the mapping
    (away from delphi atm, will check later, or someone else will fill you in)
    the equivalent of doing
    net use \\somepc\someshare password /user:someuser /persistent:no
    from the cmd prompt

    LVL 17

    Assisted Solution

    change Button1Click to do
      ConnectDrive('', '\\Servername\C', True, False);

    LVL 5

    Expert Comment

    Are you using a Dialog to save or do you insert the path in your code?

    Either way just use the '\\' at the beginning of the path (Take off any drive specifications like C:\ etc...)


    ('c:\Yourpath\yourfile.ext')  would like like this ('\\yourpath\yourfile.ext')

    If you are using the Dialogs just browser the network to the desiredv location.


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now