Question

          LiveConnectClient liveClient = new LiveConnectClient(this.session);
          LiveOperationResult operationResult =
                    await liveClient.GetAsync("folder.8c8ce076ca27823f.8C8CE076CA27823F!126");
                dynamic result = operationResult.Result;

This code is taken directly from the samples here http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#reading_files_props

It is complaining in Visual Studio 2012 that Error 2 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.

How am I supposed to modify the GetAsync function when it is part of the SkyDrive API and this is the code they've given to me to complete the operation.

I am using the most recent v5.5 of the API.

Was it helpful?

Solution

add async keyword to signature of your method. Example:

public async void YourMethod()
{
...
  LiveConnectClient liveClient = new LiveConnectClient(this.session);
          LiveOperationResult operationResult =
                    await liveClient.GetAsync("folder.8c8ce076ca27823f.8C8CE076CA27823F!126");
                dynamic result = operationResult.Result;
...
}

more info here :http://msdn.microsoft.com/en-us/library/hh191443%28VS.110%29.aspx about return Task or void in section :Return types and parameters

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top