Problem with copy file using UNC path behind InfoPath form?

K

kb at donovanhill

I have a button control which attempts to copy a file from disk to a
sharepoint library using the following VB.net code.

System.IO.File.Copy("F:\temp\test.pdf", "\\server003:40000\Shared
Documents\test.pdf")

The XP pro client PC gives the following error in the form's code
'The given path's format is not supported'

Any Ideas where I have gone wrong with the UNC path?
 
G

Gavin McKay

Hello,

I'm not sure if the File.Copy command supports posting to a sharepoint site
in this way. Posting to a sharepoint site is a HTTP PUT request from memory,
whereas the File.Copy is expecting a UNC network copy operation. Does your
"\\server003:40000\Shared Documents\" allow you to copy via Windows Explorer?
That's my standard test case - if you can browse to
"\\server003:40000\Shared Documents\" and it doesn't prompt you for security
credentials *and* comes up in explorer, then in theory File.Copy should work.
The error you are getting suggests that File.Copy does not understand either
how to get to "\\server003:40000\Shared Documents\" or how to put your
document there.

If it doesn't, you may need to either use the Sharepoint object model, or
better yet the Sharepoint web services, to put your document on your
sharepoint library. Should be plenty of examples on how to use the web
services interface and web services are definitely preferred if this process
isn't going to be run directly on your Sharepoint server.

HTH

Gavin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top