[英]How to read a onedrive folder using c# windows app
I am trying to follow a sample on MSDN to read the properties of a folder on onedrive, but I am running into some errors. 我试图按照MSDN上的示例来读取onedrive上文件夹的属性,但是遇到了一些错误。
Here is the tutorial I am following: http://msdn.microsoft.com/en-us/library/live/hh826522.aspx#reading_albums 这是我正在关注的教程: http : //msdn.microsoft.com/zh-cn/library/live/hh826522.aspx#reading_albums
The error I get when I run the code says: 运行代码时出现的错误提示:
"Error 1 'testRun.MainPage' does not contain a definition for 'session' and no extension method 'session' accepting a first argument of type 'testRun.MainPage' could be found (are you missing a using directive or an assembly reference?) C:\\Users\\me\\Desktop\\project" “错误1'testRun.MainPage'不包含'session'的定义,找不到扩展方法'session'接受类型为'testRun.MainPage'的第一个参数(您是否缺少using指令或程序集引用? )C:\\ Users \\ me \\ Desktop \\ project“
I have still looked into the issue, and haven't found out what I need to include for the LiveConnectClient parameter. 我仍然调查了这个问题,还没有找到我需要为LiveConnectClient参数添加的内容。 It only gives that it needs "LiveConnectClient session", and I am not sure what to place in for that.
它仅表明它需要“ LiveConnectClient会话”,而我不确定该在其中放置什么。
My Code: 我的代码:
private async void Button_logIn_Click(object sender, RoutedEventArgs e)
{
try
{
LiveConnectClient liveClient = new LiveConnectClient(this.session);
LiveOperationResult operationResult =
await liveClient.GetAsync("path/to/folder");
dynamic result = operationResult.Result;
this.Textblock_status.Text = string.Join(" ", "Album name:", result.name, "ID:", result.id);
}
catch (LiveConnectException exception)
{
this.Textblock_status.Text = "Error getting album info: " + exception.Message;
}
}
You need to make sure you're defining the session member, and populating it with a valid session prior to using it with LiveConnectClient. 在与LiveConnectClient一起使用之前,需要确保定义会话成员,并使用有效的会话填充它。 Check out the following documentation for a more complete example:
查看以下文档以获取更完整的示例:
http://msdn.microsoft.com/en-US/library/dn631823.aspx http://msdn.microsoft.com/en-US/library/dn631823.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.