StorageFolder.GetFolderFromPathForUserAsync(User, String) メソッド

定義

特定のユーザーのファイル システム内の絶対パスに基づいて StorageFolder を取得します。

public:
 static IAsyncOperation<StorageFolder ^> ^ GetFolderFromPathForUserAsync(User ^ user, Platform::String ^ path);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<StorageFolder> GetFolderFromPathForUserAsync(User const& user, winrt::hstring const& path);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFolder> GetFolderFromPathForUserAsync(User user, string path);
function getFolderFromPathForUserAsync(user, path)
Public Shared Function GetFolderFromPathForUserAsync (user As User, path As String) As IAsyncOperation(Of StorageFolder)

パラメーター

user
User

StorageFolder が返されるユーザー。

path
String

Platform::String

winrt::hstring

取得するフォルダーの (URI ではなく) ファイル システム内の絶対パス。

戻り値

このメソッドが正常に完了すると、ユーザーの指定したフォルダーを表す StorageFolder が返されます。

属性

Windows の要件

デバイス ファミリ
Windows 10, version 2004 (10.0.19041.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v10.0 で導入)

async Task<StorageFolder> GetStorageFolderAsync(User user, string path) {     
    // It is possible the folder no longer exists     
    // or permissions were changed so that the     
    // app no longer has access to the path.     
    try     
    {         
        return await StorageFolder.GetFolderFromPathForUserAsync(user, path);     
    }     
    catch( System.IO.IOException ex )    
    {         
        // File, or path not found I/O Exceptions can happen  
        // notify user or implement fallback, etc...         
        string message = ex.Message;         
        return null;     
    }     
    catch(System.UnauthorizedAccessException ex)     
    {         
        // Access denied - notify user or implement fallback, etc...         
        string message = ex.Message;         
        return null;
    }

注釈

このメソッドはマルチユーザー対応 (MUA) です。

適用対象

こちらもご覧ください