cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Creating Files

Highlighted

Creating Files

Explorer | Level 4

Hey everyone.

I'd like to use Dropbox's "Create File" feature in my API, but I didn't see the option in the SDK. Anyone able to locate it?

 

Thank you in advance!

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Creating Files

Dropboxer

The Dropbox API unfortunately doesn't offer access to those "Create new file" options, such as to create a web shortcut or new Word doc, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

View solution in original post

2 Replies 2
Highlighted

Re: Creating Files

Dropboxer

The Dropbox API unfortunately doesn't offer access to those "Create new file" options, such as to create a web shortcut or new Word doc, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

View solution in original post

Highlighted

Re: Creating Files

Explorer | Level 4

Hey Greg,

No problem! All I needed was a way to make a .web extension shortcut programmatically. Turns out that its a simple JSON file with the url as a variable. I remade it with a C# functions really quickly.

public static string WriteWEBExtension (string URL, string FileName)
        {
            string[] URLLines = { @"{",
                "\t" + ((char)34) + "url" + ((char)34) + ": " + ((char)34) + URL + ((char)34),
                @"}" };
            string path = System.IO.Path.GetTempPath();

            if (!path.EndsWith(@"\"))
            {
                path = path + @"\";
            }
            path = path + FileName + ".web";

            System.IO.File.WriteAllLines(path, URLLines);

            return path;

char34 is the double quotations. Hope this helps anyone else.

 

EDIT: OK... So this is a bit frustrating. Dropbox doesn't treat uploaded files like their own shortcuts. The end result of this is that while .web files do link to the correct URL in the windows explorer, they are treated as "editable" files on upload. If you are trying to send this file over to a friend, it won't automatically link. I've made a writer to URL extension instead.

        public static string WriteWEBExtension (string URL, string FileName)
        {
            string[] URLLines = {
                @"[InternetShortcut]",
                @"IDList=",
                @"URL=" + URL };

            string path = System.IO.Path.GetTempPath();
            if (!path.EndsWith(@"\"))
            {
                path = path + @"\";
            }
            path = path + FileName + ".url";

            System.IO.File.WriteAllLines(path, URLLines);
            return path;
        }

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?