Sdílet prostřednictvím


KnownFolders.RequestAccessAsync(KnownFolderId) Method

Definition

Requests access for the capability controlling access to the folder.

public:
 static IAsyncOperation<KnownFoldersAccessStatus> ^ RequestAccessAsync(KnownFolderId folderId);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<KnownFoldersAccessStatus> RequestAccessAsync(KnownFolderId const& folderId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<KnownFoldersAccessStatus> RequestAccessAsync(KnownFolderId folderId);
function requestAccessAsync(folderId)
Public Shared Function RequestAccessAsync (folderId As KnownFolderId) As IAsyncOperation(Of KnownFoldersAccessStatus)

Parameters

folderId
KnownFolderId

The Id of the folder to be returned.

Returns

Returns a KnownFolderAccessStatus enum.

Attributes

Windows requirements

Device family
Windows 10, version 2004 (introduced in 10.0.19041.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v10.0)

Remarks

If the folder is controlled by a capability and is further controlled by privacy consent, this may present a prompt to the user for consent. Therefore, it should be called on the UI thread. (If not, and a prompt is required, then the result is a status indicating the prompt is needed and otherwise denied access.

Applies to

See also