I have tried every conceivable way to Programmatically Download a File (.jpg) from a Sharepoint Site. Initially, I was successful, but then it simply stopped working. Can anyone give me some insight into this? The Code is posted below, minus the API Declarations which I know are correct. The proper File is generated and the URL is correct, but it simply will not Open (improper format). Thanks in advance.
' TEST PARAMETERS
Const conFILE_NAME = "Gates, Bill.jpg"
Const conPHOTO_PATH = "C:\Usher_Photos"
Const conURL_PATH_TO_PHOTO = "https://organization.sharepoint.com/sites/MySite/Shared%20Documents/FOHdata/" & _
lngCache = DeleteUrlCacheEntry(conURL_PATH_TO_PHOTO & Replace(conFILE_NAME, " ", "%20")) 'Encode the Space? If Dir(conPHOTO_PATH, vbDirectory) = "" Then MkDir conPHOTO_PATH Else If Dir(conPHOTO_PATH & "\*.jpg") <> "" Then Kill conPHOTO_PATH & "\*.jpg" lngRetVal = URLDownloadToFile(0, conURL_PATH_TO_PHOTO & conFILE_NAME, conPHOTO_PATH & "\" & conFILE_NAME, 0, 0) End If