How to deal with spaces in file paths?
                
                    Votuc                
                
                    Member Posts: 206                
            
                        
            
                    I have a file path that attaches a PDF to an email.  NAV does not retrieve the file from the server when I save the file in this folder name - and I suspect it is because of the spaces in the name Old Storage Drive.  Because the client computers are already mapped to this location for other reasons, it is not a good idea to change the file folder name.
How can I alter this so that the spaces in "Old Storage Drive" is not a problem?
                How can I alter this so that the spaces in "Old Storage Drive" is not a problem?
                    Mail.NewMessage(emailtoaddr,emailccaddr,STRSUBSTNO('Invoice No. %1',SalesInvHeader."No."),
                    'Attached please find invoice ' + SalesInvHeader."No."
                    +'.','\\'+Hostname+'\F$\Old Storage Drive\InvoicePrinter\Invoices\'+STRSUBSTNO
                    ('Invoice No. %1',SalesInvHeader."No.")+'.pdf',TRUE)
                0                
            Comments
- 
            
 - 
            reijermolenaar wrote:Hi Votuc,
I believe you can replace the spaces with %20.
This does not seem to work
                        0 - 
            Oh sorry, I thought you were making a link in the body and then you have to use %20 or + for spaces to make it one string.
As attachment location the spaces would not be the problem I think.
I just tested it and it works.
Even with a network path.Mail.NewMessage('info@test.com', '', 'subject', 'body', '\\l04\c$\Program Files\test test.txt', TRUE);Reijer Molenaar
Object Manager0 - 
            Thank you for your help. I wonder what is wrong. The file saves perfectly, but does not create the mail attachement. However, if I just save to F:\Invoices (folder I created) then it works perfectly. That led me to think that spaces were the problem.
//save report as PDF REPORT.SAVEASPDF(206, 'F:\Old Storage Drive\InvoicePrinter\Invoices\'+STRSUBSTNO('Invoice No. %1',SalesInvHeader."No.")+'.pdf', SalesInvHeader); //Create email attachment Mail.NewMessage(emailtoaddr,emailccaddr,STRSUBSTNO('Invoice No. %1',SalesInvHeader."No."), 'Attached please find invoice ' + SalesInvHeader."No." +'.','\\'+Hostname+'\F$\Old Storage Drive\InvoicePrinter\Invoices\'+STRSUBSTNO ('Invoice No. %1',SalesInvHeader."No.")+'.pdf',TRUE)0 - 
            in standard cases you need to put the path into "" to prevent splitting on spaces.0
 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.6K Microsoft Dynamics NAV
 - 18.7K NAV Three Tier
 - 38.4K NAV/Navision Classic Client
 - 3.6K Navision Attain
 - 2.4K Navision Financials
 - 116 Navision DOS
 - 851 Navision e-Commerce
 - 1K NAV Tips & Tricks
 - 772 NAV Dutch speaking only
 - 617 NAV Courses, Exams & Certification
 - 2K Microsoft Dynamics-Other
 - 1.5K Dynamics AX
 - 323 Dynamics CRM
 - 111 Dynamics GP
 - 10 Dynamics SL
 - 1.5K Other
 - 990 SQL General
 - 383 SQL Performance
 - 34 SQL Tips & Tricks
 - 35 Design Patterns (General & Best Practices)
 - 1 Architectural Patterns
 - 10 Design Patterns
 - 5 Implementation Patterns
 - 53 3rd Party Products, Services & Events
 - 1.6K General
 - 1.1K General Chat
 - 1.6K Website
 - 83 Testing
 - 1.2K Download section
 - 23 How Tos section
 - 252 Feedback
 - 12 NAV TechDays 2013 Sessions
 - 13 NAV TechDays 2012 Sessions
 

