How can I read all the files from a path?

SipihaSipiha Member Posts: 2
edited 2017-07-17 in NAV Three Tier
Hi all,
I have a problem when I want to read some files from my Lan network directory. The Code is like:
  CLEAR(rlFile);
  rlFile.SETRANGE(Path, '\\AnotherServer\MyDirectory\');
  rlFile.SETRANGE("Is a file", TRUE);
  IF rlFile.FINDSET THEN
    REPEAT
      vFile := rlFile.Path + rlFile.Name;
      vRutaServidor := cFileManagement.UploadFileSilent(vFile );
      flFile.OPEN(vRutaServidor);
      flFile.CREATEINSTREAM(InStream);
      XMLPORT.IMPORT(50009,InStream);
      flFile.CLOSE;
   UNTIL rlFile.NEXT = 0;

Depending on witch is the path (\\MyServer\MyDirectory\) or local one, it finds files or not. For example, in \\MyServer\MyDirectory\ doesn't find any file (there are) but if I put this, it finds correctly:
    vFile := '\\AnotherServer\MyDirectory\myfile.XML';
    vRutaServidor := cFileManagement.UploadFileSilent(vFile);
    flFile.OPEN(vRutaServidor);
    flFile.CREATEINSTREAM(InStream);
    XMLPORT.IMPORT(50009,InStream);
    flFile.CLOSE;

What can be the problem? path permissions (but it allows me to get 1 file)...
If someone can helps me, I would be grateful.

Thank you.

Best Answer

  • vaprogvaprog Member Posts: 1,116
    Answer ✓
    The problem is almost certain no access.

    If the server accesses a file, it does so with the credentials of the service user.

    If you want to access a file with the credentials of the client user, upload it first (or, if you absolutely must, use client side Dotnet).

Answers

  • vaprogvaprog Member Posts: 1,116
    Answer ✓
    The problem is almost certain no access.

    If the server accesses a file, it does so with the credentials of the service user.

    If you want to access a file with the credentials of the client user, upload it first (or, if you absolutely must, use client side Dotnet).
  • SipihaSipiha Member Posts: 2
    edited 2017-07-20
    It was an access problem (access denied in port 445). But we need to put in the security of the folder "Anyone" with all permissions. Does anyone knows what minimum permission we have to put to a folder to make folder.FINDSET work?

    Thx.
Sign In or Register to comment.