mibuso.com

Microsoft Business Solutions online community
It is currently Thu Jun 20, 2013 7:51 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Executing XMLPort and move the file
PostPosted: Wed Feb 08, 2012 4:35 pm 
Offline

Joined: Thu Feb 11, 2010 2:51 pm
Posts: 28
Country: Denmark (dk)
Little backstory, we've started looking into converting some functions to 3-tier and in porting a dataport to xmlport we ran into the following quesstion (after spending a good amount of time).

We need to call a XMLport to generate a file and have the code move it to a specific folder on the network, we tried creating the file directly in the UNC destination, but ran into a permission issue.

Is the code below really the right way to do things?

Code: Select all
Name   DataType   Subtype   Length
XMLTEST   XMLport   XMLTest
TAM   Codeunit   3-Tier Automation Mgt.   
WSH   Automation   'Windows Script Host Object Model'.FileSystemObject   
TempFileName   Text      1024
NewFileName   Text      1024
InFile   File      

//Generate the file.
FileName := 'test.txt';
InFile.CREATE(Filename);
InFile.CREATEOUTSTREAM(XmlOutStream);
XMLTest.SETDESTINATION(XmlOutStream);
XMLTest.EXPORT;
InFile.CLOSE;
CLEAR(XmlOutStream);

//Move the file to the destination folder.
NewFilename := 'H:\test-xmlport.txt'; //H:\ or \\servername\folder
TempFileName := TAM.DOWNLOADTEMPFile(FileName);
CREATE(Wsh,true,true);
WSH.MoveFile(TempFileName, NewFileName)
CLEAR(WSH);


Note: Above code has had variables renamed for posting.


Top
 Profile E-mail  
 
 Post subject: Re: Executing XMLPort and move the file
PostPosted: Thu Feb 16, 2012 7:57 am 
Offline

Joined: Tue Oct 18, 2005 9:47 am
Posts: 75
Location: Wellington
Country: New Zealand (nz)
You said you ran into a permission issue. Are you running the NAV Service under the local system account? If you are then try to change this to the NetworkService account.

Regards

_________________
Claus Hamann

www.AcumenConsulting.co.nz


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: