Codeunit with CREATE - Error: Either the caller does not have the required permission ...

p0wertubep0wertube Member Posts: 13
Hey Guys,

i built a xmlport to export table data to a .csv / .txt. This works.

Now I'm trying to make a codeunit, which creates the file to a specific folder.

This is the code i am using in the codeunit:

varXmlFile.CREATE('C:\Program Files (x86)\Microsoft Dynamics NAV');
varXmlFile.CREATEOUTSTREAM(varOutputStream);
XMLPORT.EXPORT(XMLPORT::StockkeepingFile, varOutputStream);
varXmlFile.CLOSE;


When trying to run the codeunit, i'll get the error message "Either the caller does not have the required permission or the specified path is read-only"

As we have a three-tier technology, I gave permissions to the specified folder on the service tier, restarted the service and tried again, but error message is still the same.

What could be the problem?

Best Answer

  • Rishi1109Rishi1109 Member Posts: 43
    Answer ✓
    include file name with extension in FilePath
    Thanks and Regards
    Rishi

Answers

  • Rishi1109Rishi1109 Member Posts: 43
    Answer ✓
    include file name with extension in FilePath
    Thanks and Regards
    Rishi
  • aceXaceX Member Posts: 166
    Hi @p0wertube,

    I think you should give permission to the user with whom you are running the service. You can see this in administration tool. Or if you thing it's safe, in folder security give the read/write (full permission) to Everyone.

    Regards
  • p0wertubep0wertube Member Posts: 13
    Rishi1109 wrote: »
    include file name with extension in FilePath


    indeed, this was the problem. Thanks!
Sign In or Register to comment.