cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i upload file to my Dropbox account with vba ?

How can i upload file to my Dropbox account with vba ?

ElsayedGamal
Explorer | Level 3

Hello My Friends

i need to upload file to my drobpox account by vba with access database

how can i d that ?

6 Replies 6

Lusil
Dropbox Staff
 
If you’re trying to do this through the desktop app, please note that your Dropbox folder is just like any other folder on your hard drive, but with syncing features. In other words, you can save a file your have on your computer in the Dropbox folder, and it will sync the file to the website and other connected devices. 
 
If you’re having trouble doing this, or if I’ve misunderstood what it is you’re trying to achieve, could you please elaborate a bit more on this and, if you’re seeing an error, could you please send me a screenshot (omitting any personal info) illustrating the behavior you’re experiencing?
 
Thanks! :slight_smile:

Lusil
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, please give it a Like below.
:arrows_counterclockwise: Still stuck? Ask me a question!
:pushpin: Tips & Tricks Find new ways to stay in flow or share your tips on how you work smarter with Dropbox.

ElsayedGamal
Explorer | Level 3

thanks for reply

i need to upload file with code to my online dropbox 

i found that code but i need to know how i use

like where i will put my username and passwod of my dropbox account ?

and wher i will put my online drobpox folder Url

and what is my online drobpox folder Url

Public Sub DB_PutFile(FileName As String)
Dim req As MSXML2.ServerXMLHTTP60
Dim strFile As String
Dim Pos1 As Integer
Dim Pos2 As Integer
Set req = New MSXML2.ServerXMLHTTP60
Dim arg As String
strFile= ReadBinary(FileName)
arg = "{""path"":""/" & FileName & """,""mode"":{"".tag"":""overwrite""},""autorename"":false,""mute"":true}"
req.Open "POST", "https://content.dropboxapi.com/2/files/upload", False
req.setRequestHeader "Authorization", "Bearer xxxxxxxxxxxxxxxx"
req.setRequestHeader "Content-Type", "application/octet-stream"
req.setRequestHeader "Content-length", Len(Result)
req.setRequestHeader "Dropbox-API-Arg", arg
req.setRequestHeader "User-Agent", "api-explorer-client"
req.send strFile

If req.Status = 200 Then

Debug.Print req.responseText

Else
'MsgBox req.Status & ": " & req.statusText
Debug.Print req.responseText
End If
End Sub

thanks

Lusil
Dropbox Staff
Thanks for the swift reply, @ElsayedGamal
 
Could you please clarify if you’re creating an app that uses the Dropbox API? If so, please let me know and I can forward this thread to the appropriate section.
 
Let me know and I’ll make sure to get back to you as soon as possible!

Lusil
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, please give it a Like below.
:arrows_counterclockwise: Still stuck? Ask me a question!
:pushpin: Tips & Tricks Find new ways to stay in flow or share your tips on how you work smarter with Dropbox.

ElsayedGamal
Explorer | Level 3

 i make an access Database

by that Access DB  i need to upload report.txt  to my Drobpox online folder

how can i do that with Microsoft visual basic 6 VBA

iknow i can download Drobpox app an setup it and i will copy my report .txt to drobpox folder  i know that

but i didnt need to do that because i will use My access DB in More PC

so i will not Setup on every PC that Drobpox App

so what can i do

and thanks for your replay

Lusil
Dropbox Staff
Thanks for your quick reply once again, @ElsayedGamal, and for the additional info. 
 
I’ve forwarded you to the API Support section of the Forum, where some like-minded users might be able to help out on this. 
 
Cheers! :grin:

Lusil
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, please give it a Like below.
:arrows_counterclockwise: Still stuck? Ask me a question!
:pushpin: Tips & Tricks Find new ways to stay in flow or share your tips on how you work smarter with Dropbox.

Greg-DB
Dropbox Staff

@ElsayedGamal It sounds like you want to programmatically upload files to your Dropbox account. To do so, you should use the Dropbox API. I see from the code you shared that you already found the correct API endpoint, /2/files/upload, for doing so. (We also have an official .NET SDK that makes this easier, if you can use that in your environment.) 

In either case, you don't put your username and password in the code. You authorize the API calls by the use of a Dropbox API OAuth 2 access token. I see you already have code for setting that in the "Authorization" header. 

The path where you want the uploaded file to go in your Dropbox is specified by the "path" parameter in the JSON you put in the "Dropbox-API-Arg" header. 

For more information on how to use this endpoint, please refer to the /2/files/upload documentation. The API v2 Explorer can also be useful for prototyping these calls.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Lusil Dropbox Staff
  • User avatar
    ElsayedGamal Explorer | Level 3
What do Dropbox user levels mean?