C# 读取下载的TXT OneDrive

C# 读取下载的TXT OneDrive,c#,C#,我正在使用以下代码加载OneDrive txt文件: var downloadOperationResult=wait cliente.DownloadAsync(idOfFile) 我使用以下代码读取下载的文件(代替注释://download completed) 但不是读取txt,而是读取文件属性。 输出: 有人能帮我吗? (我正在为Windows Phone开发)不久前有人问过这个问题,但有人可能会从答案中发现价值。在Windows Phone上,您将希望异步处理文件下载。这是为了处理用户

我正在使用以下代码加载OneDrive txt文件:

var downloadOperationResult=wait cliente.DownloadAsync(idOfFile)

我使用以下代码读取下载的文件(代替注释://download completed)

但不是读取txt,而是读取文件属性。 输出:

有人能帮我吗?
(我正在为Windows Phone开发)

不久前有人问过这个问题,但有人可能会从答案中发现价值。在Windows Phone上,您将希望异步处理文件下载。这是为了处理用户可能从应用程序分页的情况

你可以在以下网址找到更多信息:


要获取文件内容而不是文件元数据,请向文件ID添加“/content”

文件元数据

path = "file.8c8ce076ca27823f.8C8CE076CA27823F!129"
文件内容

path = "file.8c8ce076ca27823f.8C8CE076CA27823F!129/content"
例如:

LiveConnectClient liveClient = new LiveConnectClient(liveSession);
LiveDownloadOperation operation = 
             await liveClient.CreateBackgroundDownloadAsync(fileId + "/content");
var operationResult = await operation.StartAsync();

var fileContent = 
             await CustomMethod(await operationResult.GetRandomAccessStreamAsync());

return fileContent;
try
{
    LiveDownloadOperation operation = await connectClient.CreateBackgroundDownloadAsync(filePath);
    var result = await operation.StartAsync();
    // Handle result.
}
catch
{
    // Handle errors.
}
path = "file.8c8ce076ca27823f.8C8CE076CA27823F!129"
path = "file.8c8ce076ca27823f.8C8CE076CA27823F!129/content"
LiveConnectClient liveClient = new LiveConnectClient(liveSession);
LiveDownloadOperation operation = 
             await liveClient.CreateBackgroundDownloadAsync(fileId + "/content");
var operationResult = await operation.StartAsync();

var fileContent = 
             await CustomMethod(await operationResult.GetRandomAccessStreamAsync());

return fileContent;