cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know more about how Community ideas impact Dropbox development? Check it out here

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: 

Re: Creating Files

Creating Files

AGreenTejada
Helpful | Level 5

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

Re: Creating Files

Greg-DB
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

Re: Creating Files

Greg-DB
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

Re: Creating Files

AGreenTejada
Helpful | Level 5

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;
        }
Need more support?