Page 1 of 1

Programmatically obtain Dropbox share link

Posted: 12 Jul 2016 00:40
by bifjamod
When accessing the right-click context menu in XYPlorer, it is possible to obtain the URL for a Dropbox file, so that it can be shared ("Copy Dropbox Link.") My need is to programmatically obtain that link, rather than obtaining it manually. I do not have sufficient knowledge (nor the time to invest in gaining that knowledge) to develop something through the Dropbox API that would allow me to do this. Since XYPlorer already does it, my question is this:
Is there a way I can call XYPlorer to obtain the link?
I already know the "internal" path of the file in question (c:\Dropbox\Files\Doc1.pdf). It seems to be there should be a way to have (preferably) VBA call XYPlorer, pull the Dropbox link, and return the link to clipboard control. Can anyone offer some insight into how I might do this?

Re: Programmatically obtain Dropbox share link

Posted: 12 Jul 2016 12:04
by highend
Afaik: Not possible

1. XY isn't involved in any way. The context menu that creates this link is done solely through the dropbox software
2. Dropbox's API doesn't provide a method to get this public link

The linux version has a cli script (.py) which has an argument "puburl" but I guess it's outdated (and I didn't try if it still works):

Code: Select all

    try:
        with closing(DropboxCommand()) as dc:
            try:
                console_print(dc.get_public_link(path=unicode_abspath(args[0].decode(sys.getfilesystemencoding()))).get(u'link', [u'No Link'])[0])
this get_public_link() method doesn't seem to exist anymore

Re: Programmatically obtain Dropbox share link

Posted: 12 Jul 2016 16:03
by bifjamod
Thank you highend; I did not realize the context menu functionality originated from the Dropbox app itself.

Re: Programmatically obtain Dropbox share link

Posted: 12 Jul 2016 19:54
by highend
Actually, it is possible...

The current api provides:
sharing_create_shared_link_with_settings
and
sharing_get_shared_links

so this could be done e.g. via a python script (or any other language that supports the dropbox api, e.g. javascript)

by:
- checking if there are shared files
- if the specific file isn't shared yet, share it, copy the link to the clipboard
- if it's shared get it's url and copy it to the clipboard

Re: Programmatically obtain Dropbox share link

Posted: 12 Jul 2016 20:26
by bifjamod
Hmmm, keeping the dream alive! Pretty much anything outside of VBA is outside my skillset, but I'm asking a guy I know to see if he can help me work that out via VBA anyway. My thinking is it may be possible to call Javascript from VBA.