DownloadsFolder class

Applies to Windows only

Creates files and folders inside the Downloads folder.

Syntax


public static class DownloadsFolder

Attributes

[Version(0x06020000)]

Members

The DownloadsFolder class has these types of members:

Methods

The DownloadsFolder class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
CreateFileAsync(String) Creates a new file inside the Downloads folder.
CreateFileAsync(String, CreationCollisionOption) Creates a new file in the Downloads folder, and specifies what to do if a file with the same name already exists in the Downloads folder.
CreateFolderAsync(String) Creates a new subfolder in the Downloads folder.
CreateFolderAsync(String, CreationCollisionOption) Creates a new subfolder in the Downloads folder, and specifies what to do if a subfolder with the same name already exists in the Downloads folder.

 

Remarks

This class is static and cannot be instantiated. Call the methods directly instead.

File and folder permissions in the Downloads folder

All apps can create files and folders in the Downloads folder and can access the files that they create. But apps can't access files in the Downloads folder that they didn't create.

When your app creates a file in the Downloads folder, other apps can't interfere with or access your file unless the user explicitly gives the other app access. The user can give another app access to your file by selecting the file from the file picker. Your app can also use the file picker to get access to the files in the Downloads folder that it didn't create. Learn more about opening files with the file picker in Quickstart: Accessing files with a file picker.

Capabilities are not needed to create or access files in the Downloads folder. Learn more about capabilities in Access to user resources using the Windows Runtime.

To learn more about what locations your app can access, see File access and permissions in Windows Store apps.

Examples

You can create an empty file in the Downloads folder like this:


StorageFile file = await Windows.Storage.DownloadsFolder.CreateFileAsync("sample.txt");
// Process file

After createFileAsync completes, file gets the new file as a StorageFile.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft