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.

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

Creating Files

AGreenTejada
Helpful | Level 5
Go to solution

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

Greg-DB
Dropbox Staff
Go to solution

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

Greg-DB
Dropbox Staff
Go to solution

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. 

AGreenTejada
Helpful | Level 5
Go to solution

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?
Who's talking

Top contributors to this post

  • User avatar
    AGreenTejada Helpful | Level 5
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?