question

ArmDezii-7977 avatar image
0 Votes"
ArmDezii-7977 asked ArmDezii-7977 commented

Programmatically Download File From Sharepoint Site

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/" & _
"Usher%20Photos/Active/"
'
**

 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
office-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ArmDezii-7977,

I am currently doing some research on this issue, will let you know as soon as possible.

0 Votes 0 ·

1 Answer

TongZhangMSFT-7548 avatar image
0 Votes"
TongZhangMSFT-7548 answered ArmDezii-7977 commented

Hi @ArmDezii-7977,

Our forum mainly discuss about SharePoint development using C#, Since your question is about VBA , we suggest you create a new thread on techcommunity for help, more professional will assist you.

techcommunity :

https://techcommunity.microsoft.com/t5/sharepoint-developer/bd-p/SharePointDev


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, TongZhanjMSFT-7548 for your insight into this, I will definitely follow up with the Tech Community on this.

0 Votes 0 ·