Hi
 
I'm trying to write a test harness for some application code, and part of the 
setup method is to map a network drive / network place to a webdav folder. 
After extensive googling I can't seem to find any examples in any language :-/ 
Perhaps that's a bad omen, but being optimistic -
 
Hopefully I'm right in thinking the WNetAddConnection2() call is the right 
approach. I've tried various options, but after a load of digging I've sussed 
(hopefully correct!) that I should set the provider name to "Web Client 
Network" rather than None, since this always generated an error 67 code
I have an unsecured Tomcat4.1 server on a machine nearby which has a webdav 
folder installed. To attempt to map this I use
 
import win32net
import win32netcon
import win32wnet
 
win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", 
"http://192.168.2.6/webdav/ <http://192.168.2.6/webdav/> ", "Web Client 
Network", None, None, 0)
 
But I'm getting
 
    win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", 
"http://192.168.2.6/webdav/ <http://192.168.2.6/webdav/> ", "Web Client 
Network", None, None, 0)
error: (53, 'WNetAddConnection2', 'The network path was not found.')
 
If I try to add a network place manually to the same location it succeeds.
 
Two aspects puzzle me:
 
- Webdav locations tend to exist under My Network Places, so is the call 
getting hung up on trying to map drive Z ?  But what should I pass in as the 
local name for the call to work?
 
- Utimately I need to turn on access control in the webdav server (that's part 
of the testing to conduct). If the webdav prompt contains an basic 
authentication realm "foo", should my call be
win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", 
"http://192.168.2.6/webdav/ <http://192.168.2.6/webdav/> ", "Web Client 
Network", "[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ", "password", 0) ?
 
I did wonder if the win32net.NetUseAdd() call has any mileage as an alternative?
 
I'm on WinXP Professional SP1,   ActiveState Python 2.4.1
 
 
Tim

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to