Connecting to WebDAV Server Using AppleScript

Hi All,

I am new to AppleScript development. Can anyone please tell me how to connect to a WebDAV server from my application and do the listing of files from the server.

An early reply will be appreciated.

Thanks in advance.

Suresh

Following script from Jan T. Sott Copyright (c) 2013 is published on GitHub site. It connects (mounts to your MAC) the WebDAV server. After mounting the server, the corresponding directory will appear on your MAC, so you can list its contents using some existing directory listing methods.
.

-- Settings
set davPath to "https://your.server/path"
set davUser to "KniazidisR"

connectWebDAVserver(davPath, davUser) -- connect to WebDAV server


on connectWebDAVserver(davPath, davUser)
	-- Do not edit the lines below unless you know what you're doing!
	if length of davPath is less than 8 then
		display dialog "No valid server property specified in script" with icon caution buttons "OK"
		error number -128
	end if
	if length of davUser is 0 then
		display dialog "No user property specified in script" with icon caution buttons "OK"
		error number -128
	end if
	try
		set windowDialog to "Please enter the password for " & davUser
		set davPassword to display dialog ¬
			windowDialog with title ¬
			"Password" default answer ¬
			"" buttons {"Cancel", "OK"} default button 2 ¬
			with hidden answer
		if length of (text returned of davPassword) is not 0 then
			mount volume davPath as user name davUser with password (text returned of davPassword)
		end if
	end try
end connectWebDAVserver
1 Like