繁体   English   中英

如何使用C#Windows App读取OneDrive文件夹

[英]How to read a onedrive folder using c# windows app

我试图按照MSDN上的示例来读取onedrive上文件夹的属性,但是遇到了一些错误。

这是我正在关注的教程: http : //msdn.microsoft.com/zh-cn/library/live/hh826522.aspx#reading_albums

运行代码时出现的错误提示:

“错误1'testRun.MainPage'不包含'session'的定义,找不到扩展方法'session'接受类型为'testRun.MainPage'的第一个参数(您是否缺少using指令或程序集引用? )C:\\ Users \\ me \\ Desktop \\ project“

我仍然调查了这个问题,还没有找到我需要为LiveConnectClient参数添加的内容。 它仅表明它需要“ LiveConnectClient会话”,而我不确定该在其中放置什么。

我的代码:

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;
            }
        }

在与LiveConnectClient一起使用之前,需要确保定义会话成员,并使用有效的会话填充它。 查看以下文档以获取更完整的示例:

http://msdn.microsoft.com/en-US/library/dn631823.aspx

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM