You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93-76Lines changed: 93 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,36 +3,36 @@
3
3
4
4
WebDavLib is a LiveCode library for accessing WebDAV servers. it supports Digest and Basic authentication. WebDavLib does not depend on tsNet and can therefore be used with the Community Edition.
5
5
6
-
##### WebDavLib currently supports the following WebDAV methods:
6
+
##### WebDavLib currently supports the following WebDAV methods:
7
7
8
-
- OPTIONS
9
-
- PROPFIND
10
-
- HEAD
11
-
- GET
12
-
- PUT
13
-
- DELETE
14
-
- MKCOL
15
-
- PROPPATCH
16
-
- LOCK
17
-
- UNLOCK
8
+
-OPTIONS
9
+
-PROPFIND
10
+
-HEAD
11
+
-GET
12
+
-PUT
13
+
-DELETE
14
+
-MKCOL
15
+
-PROPPATCH
16
+
-LOCK
17
+
-UNLOCK
18
18
19
19
20
20
##### Examples of tasks the library allows to accomplish:
21
21
22
-
- Generate a list of all WebDAV methods provided by the server
23
-
- Get the file size, modification date, content type etc. of a remote file
24
-
- Download a file
25
-
- Check write permission of a directory
26
-
- Upload a file
27
-
- Delete a file / folder
28
-
- List files / folders
29
-
- Create a folder
30
-
- Set custom file properties
31
-
- Get custom file properties
32
-
- Remove custom file properties
33
-
- Lock a file (may be not supported on NextCloud servers)
34
-
- Check if a file is locked
35
-
- Unlock a file (may be not supported on NextCloud servers)
22
+
-Generate a list of all WebDAV methods provided by the server
23
+
-Get the file size, modification date, content type etc. of a remote file
24
+
-Download a file
25
+
-Check write permission of a directory
26
+
-Upload a file
27
+
-Delete a file / folder
28
+
-List files / folders
29
+
-Create a folder
30
+
-Set custom file properties
31
+
-Get custom file properties
32
+
-Remove custom file properties
33
+
-Lock a file (may be not supported on NextCloud servers)
34
+
-Check if a file is locked
35
+
-Unlock a file (may be not supported on NextCloud servers)
36
36
37
37
WebDavLib is tested on a commercial NextCloud server, on a private NextCloud server and on a local WebDAV server.
38
38
@@ -44,73 +44,90 @@ Check out the enclosed sample stack "webDavTest". Fill out the form and execute
44
44
45
45
### Usage
46
46
47
-
Basically the procedure to send a WebDAV request involves:
47
+
Basically the procedure to send a WebDAV request involves:
48
48
49
-
- Setting up the request data using an array
50
-
- Storing the request data in WebDavLib which returns a request ID
51
-
- Sending the request to the server to receive a response
49
+
-Setting up the request data using an array
50
+
-Storing the request data in WebDavLib which returns a request ID
51
+
-Sending the request to the server to receive a response
52
52
53
-
Following is an example (returning the WebDAV methods the server supports):
53
+
Following is an example (returning the WebDAV methods the server supports):
54
54
55
55
```
56
-
-- SETUP REQUEST DATA
57
-
put fld "hostFld" into tRequestDataA["host"]
58
-
put fld "portFld" into tRequestDataA["port"]
59
-
put fld "userFld" into tRequestDataA["user"]
60
-
put fld "passwordFld" into tRequestDataA["password"]
61
-
put the label of btn "authBtn" into tRequestDataA["authType"]
62
-
put the hilite of btn "secureBtn" into tRequestDataA["sslFlag"]
63
-
put the cAgent of this stack && the version && "(" & the platform & ")" into tRequestDataA["agent"]
64
-
put fld "davDirFld" into tRequestDataA["uri"]
65
-
put "OPTIONS" into tRequestDataA["method"]
66
-
67
-
-- STORE REQUEST DATA IN LIBRARY, GET REQUEST ID
68
-
wdlSetupNewRequest tRequestDataA
69
-
put the result into tReqID
70
-
71
-
-- SEND REQUEST TO SERVER
72
-
put wdlExecute(tReqID) into tServerResponse
73
-
74
-
wdlCleanup tReqID
56
+
-- SETUP REQUEST DATA
57
+
put fld "hostFld" into tRequestDataA["host"]
58
+
put fld "portFld" into tRequestDataA["port"]
59
+
put fld "userFld" into tRequestDataA["user"]
60
+
put fld "passwordFld" into tRequestDataA["password"]
61
+
put the label of btn "authBtn" into tRequestDataA["authType"]
62
+
put the hilite of btn "secureBtn" into tRequestDataA["sslFlag"]
63
+
put the cAgent of this stack && the version && "(" & the platform & ")" into tRequestDataA["agent"]
64
+
put fld "davDirFld" into tRequestDataA["uri"]
65
+
66
+
-- STORE REQUEST DATA IN LIBRARY, GET REQUEST ID
67
+
wdlSetupNewRequest tRequestDataA
68
+
put the result into tReqID
69
+
70
+
-- SEND REQUEST TO SERVER
71
+
put wdlGetserverMethods(tReqID) into tServerResponse
72
+
73
+
wdlCleanup tReqID
75
74
```
76
75
77
-
These are the request data array keys used depending on the particular request method:
78
-
79
-
- host (the host address like: myname.ocloud.de)
80
-
- uri (the path to the WebDAV directory like: /remote.php/webdav/)
81
-
- port (as a general rule this is 80 or 443 for secure connections)
82
-
- user
83
-
- password (user password or app password)
84
-
- authType (Basic or Digest)
85
-
- sslFlag (a boolean, TRUE for a secure connection)
86
-
- method (see the WebDav methods above)
87
-
- agent (User-agent)
88
-
- propertiesXML (the properties XML data inserted into a XML request body)
89
-
- contentType (Content-type like application/xml; charset="utf-8")
90
-
- contentLength
91
-
- dataToUpload (the binary file data to upload)
92
-
- nameSpace (WebDAV XML namespace like http://www.w3.com/standards/z39.50/)
93
-
- lockScope (exclusive or shared)
94
-
- lockType (write)
95
-
- lockOwner (any name)
96
-
- lockToken (the cCurrentLockToken of stack "WebDavLib")
97
-
- callBack (the name of a callback handler used by methods GET and PUT)
98
-
- callbackTarget (the long ID of the object containing the callback handler)
76
+
These are the request data array keys used depending on the particular request method:
77
+
78
+
- host (the host address like: myname.ocloud.de)
79
+
- uri (the path to the WebDAV directory like: /remote.php/webdav/)
80
+
- port (as a general rule this is 80 or 443 for secure connections)
81
+
- user
82
+
- password (user password or app password)
83
+
- authType (Basic or Digest)
84
+
- sslFlag (a boolean, TRUE for a secure connection)
85
+
- method (see the WebDav methods above)
86
+
- agent (User-agent)
87
+
- propertiesXML (the properties XML data inserted into a XML request body)
88
+
- contentType (Content-type like application/xml; charset="utf-8")
89
+
- contentLength
90
+
- dataToUpload (the binary file data to upload)
91
+
- nameSpace (WebDAV XML namespace like "http://www.w3.com/standards/z39.50/")
92
+
- lockScope (exclusive or shared)
93
+
- lockType (write)
94
+
- lockOwner (any name)
95
+
- lockToken (the cCurrentLockToken of stack "WebDavLib")
96
+
- callBack (the name of a callback handler used by methods GET and PUT)
97
+
- callbackTarget (the long ID of the object containing the callback handler)
**NOTE:** Be aware that if you use the LC Indy Edition or the LC Business Edition WebDavLib does not work if the tsNet external is loaded. So, to use the WebDavLib library you need to unload tsNetLibURL like:
102
120
103
121
```
104
-
if the environment is "development" and there is a stack "tsNetLibURL" then
105
-
dispatch "revUnloadLibrary" to stack "tsNetLibURL"
106
-
end if
122
+
if the environment is "development" and there is a stack "tsNetLibURL" then
123
+
dispatch "revUnloadLibrary" to stack "tsNetLibURL"
124
+
end if
107
125
```
108
126
109
127
See button "requestBtn" in the enclosed sample stack.
0 commit comments