webdav over https

V

vilmarci

Dear Community,

I would like to export some Access query results to a Sharepoint document
library. The site requires authentication, uses https, so a simple export to
the webfolder does not work. How can I copy the results with VBA? I
understood that I need to use webdav. I tested with TotalCommander and its
webdav plugin can connect to the document library on the site. I looked at
many code samples on the internet, but none of them worked, maybe because
all of them used simple http connection.

Please advise,
Thanks,
vm
 
V

vilmarci

Hi,

Update. After long search & try.
The code below gives me -2147467262 error in the .Open row, and the result
is a file with 0 bytes in the destination webfolder.

Code:
Private Sub test()
Dim recDir As New ADODB.Record
Dim stmData As New ADODB.Stream
Dim step As String
step = "recdir open"
On Error GoTo HIBA
recDir.Open "dates.xls", "URL=https://www.mysite.com/sites/reporting/Shared
Documents/uploadtest", _
adModeReadWrite, _
adCreateNonCollection Or adCreateOverwrite, _
adDelayFetchStream, _
"domain\username", _
"pw"
step = "stream data"
With stmData
..Read
..Type = adTypeBinary
..Open recDir, adModeWrite, adOpenStreamFromRecord
..LoadFromFile "C:\test\dates.xls"
..Close
End With
recDir.Close
Exit Sub
HIBA:
Debug.Print step
Debug.Print Err.Description
Debug.Print Err.Number
End Sub

Does anyone have any advise how to go further?
Thanks,
vm
 

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