Options

Saving file to Shared Drive Issue

jflynnjflynn Member Posts: 34
edited 2010-11-25 in NAV Three Tier
I have the code below that currently saves a file to the
C:\Documents and Settings\All Users\Application Data\Microsoft\Microsoft Dynamics NAV\60\Server\WLC\"USERID" folder on the computer of the middle tier. This code works. I would like to save the file to a shared drive on another computer. The middle tier service account has rights to the share drive both in folder permissions and share permissions. I have experimented with the DOWNLOAD function, but need to do this without the user getting involved.

The exact error I get in the RTC is
"Either the caller does not have the required permission or the specified path is read-only."

Here is the code
// folder on share drive
WorkingDir := '\\neptune\shared\ProdRep\FTP';
IF NOT Item.GET(ItemNo) THEN
EXIT;
Delim := '|';
FileName := (WorkingDir+'\10000001.888');
ExportFile.CREATE(FileName);
ExportFile.TEXTMODE(TRUE);
WITH Item DO
ExportFile.WRITE(
'PMF' + Delim +
"No." + Delim +
Description + "Description 2");
ExportFile.CLOSE;

Thanks in advance for your help.

Joe

(Solved using detlaf's solution below. Thanks to all)
Joe

Answers

  • Options
    sdconantsdconant Member Posts: 3
    I had this problem also. It seems the service tier can only write to a local drive, but you can get around this by saving your file to a temporary directory, then using the DOWNLOAD function to copy the temporary file to a location/filename of your choosing. Then you can delete the temp file as a cleanup operation.

    DOWNLOAD(FromFile, DialogTitle, ToFolder, ToFilter, ToFile)

    Check out the helpfile for more info. It works like a champ for me. Otherwise you might want to write a server side script to move the files over to your network drive on a timed basis. I couldn't get an RTC instance to write directly to a network drive.
  • Options
    detlefdetlef Member Posts: 38
    This is another delegation issue.
    - In Active Directory Users and Computers open the properties of the user running the NAV Server Service.
    - Select the delegation Tab
    - Click on Add
    - Click Users and Computers...
    - Type in the server name that has the share
    - Select cfis (if its not there, you need to add the SPN) - HOST may work as well
  • Options
    mostlemostle Member Posts: 5
    I had the same issue this week:
    I solved it by adding the following two SPNs to the Service User of the Service Tier:
    HTTP/ServiceTierServername
    HTTP/ServiceTierServername.FQDN

    And in in setting the delegation to "Trust this user for delegation to any service (Kerberos only)"
    Maybe it is possible to restrict the delegation to the HTTP service, but as I need the Enterprise Admins to evaluate this, I just use "any service" :-)

    But I need to try detlefs solution as well...
  • Options
    anaforniesanafornies Member Posts: 6
    Hi!
    I had the same problem, but the user running rtc services in local system account. How I could apply delegation to this user? In Active Directory can´t find Local System account because it´s protected.
    Thx!
  • Options
    detlefdetlef Member Posts: 38
    anafornies wrote:
    Hi!
    I had the same problem, but the user running rtc services in local system account. How I could apply delegation to this user? In Active Directory can´t find Local System account because it´s protected.
    Thx!

    Use Network Service account instead of Local System. Then add Delegation for the Server running the NAV Service in Active Directory.
Sign In or Register to comment.