Jump to content

Service - Write files to UNC-Path


khuemmeler

Recommended Posts

@Khuemmeler

In Service mode,  without account write rights, destination folder must be in  :  PublicDocuments

IMHO (In my humble opinion)

So, Copying your XML in :

\\Server\users\....\PublicDocuments

Where,  of course  PublicDocument is shared (in group residential)

Regards.

Link to comment
Share on other sites

Solved by using this code-snippet:

function MakeDriveMapping(DriveLetter: string; DirectoryPath: string;
  Username: string; Password: string; RestoreAtLogon: Boolean): DWORD;
var
  NetResource: TNetResource;
  dwFlags: DWORD;
begin
  with NetResource do
  begin
    dwType := RESOURCETYPE_DISK;
    lpLocalName := PChar(DriveLetter);
    lpRemoteName := PChar(DirectoryPath);
  lpProvider := nil;
  end;
  if (RestoreAtLogon) then
    dwFlags := CONNECT_UPDATE_PROFILE
  else
    dwFlags := 0;
  Result := WNetAddConnection2(NetResource, PChar(Password),
    PChar(Username), dwFlags);
end;


 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...