質問

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.

Here is the tutorial I am following: http://msdn.microsoft.com/en-us/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"

I have still looked into the issue, and haven't found out what I need to include for the LiveConnectClient parameter. It only gives that it needs "LiveConnectClient session", and I am not sure what to place in for that.

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. Check out the following documentation for a more complete example:

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top