StorageFile.GetFileFromPathForUserAsync(User, String) 메서드

정의

지정된 사용자에 대한 파일 시스템의 절대 경로를 기반으로 하는 StorageFile 개체를 가져옵니다.

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

매개 변수

user
User

StorageFile이 반환되는 사용자입니다.

path
String

Platform::String

winrt::hstring

나타낼 StorageFile 을 가져올 파일의 경로입니다.

경로에서 슬래시를 사용하는 경우 백슬라이쉬(\)를 사용해야 합니다. 슬래시(/)는 이 메서드에서 허용되지 않습니다.

반환

이 메서드가 완료되면 파일을 StorageFile로 반환합니다.

특성

Windows 요구 사항

디바이스 패밀리
Windows 10, version 2004 (10.0.19041.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v10.0에서 도입되었습니다.)

예제

async Task<StorageFile> GetStorageFileAsync(User user, string path) {     
    // It is possible the file no longer exists     
    // or permissions were changed so that the     
    // app no longer has access to the path.     
    try     
    {         
        return await StorageFile.GetFileFromPathForUserAsync(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(다중 사용자 인식)입니다.

적용 대상

추가 정보