本文整理汇总了C#中Microsoft.Live.LiveConnectClient.CopyAsync方法的典型用法代码示例。如果您正苦于以下问题:C# LiveConnectClient.CopyAsync方法的具体用法?C# LiveConnectClient.CopyAsync怎么用?C# LiveConnectClient.CopyAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Live.LiveConnectClient
的用法示例。
在下文中一共展示了LiveConnectClient.CopyAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenameLiveFolder
public async Task<Boolean> RenameLiveFolder(String OldName, String NewName)
{
try
{
LiveConnectClient uploadClient = new LiveConnectClient(meClient.Session);
LiveOperationResult result = await uploadClient.GetAsync("/me/skydrive/files");
dynamic files = result.Result;
List<object> data = (List<object>)files.data;
foreach (dynamic item in data)
{
if (item.name == OldName)
{
try
{
LoadProfile(NewName);
await uploadClient.CopyAsync(OldName, NewName);
await uploadClient.DeleteAsync(OldName);
return true;
}
catch (NullReferenceException)
{
return false;
}
catch (FileNotFoundException)
{
return false;
}
catch (ArgumentOutOfRangeException)
{
return false;
}
}
}
}
catch (NullReferenceException)
{
}
catch (LiveConnectException)
{
}
return false;
}
示例2: RunButton_Click
private async void RunButton_Click(object sender, RoutedEventArgs e)
{
try
{
// Validate parameters
string path = pathTextBox.Text;
string destination = destinationTextBox.Text;
string requestBody = requestBodyTextBox.Text;
var scope = (authScopesComboBox.SelectedValue as ComboBoxItem).Content as string;
var method = (methodsComboBox.SelectedValue as ComboBoxItem).Content as string;
// acquire auth permissions
var authClient = new LiveAuthClient();
var authResult = await authClient.LoginAsync(new string[] { scope });
if (authResult.Session == null)
{
throw new InvalidOperationException("You need to login and give permission to the app.");
}
var liveConnectClient = new LiveConnectClient(authResult.Session);
LiveOperationResult operationResult = null;
switch (method)
{
case "GET":
operationResult = await liveConnectClient.GetAsync(path);
break;
case "POST":
operationResult = await liveConnectClient.PostAsync(path, requestBody);
break;
case "PUT":
operationResult = await liveConnectClient.PutAsync(path, requestBody);
break;
case "DELETE":
operationResult = await liveConnectClient.DeleteAsync(path);
break;
case "COPY":
operationResult = await liveConnectClient.CopyAsync(path, destination);
break;
case "MOVE":
operationResult = await liveConnectClient.MoveAsync(path, destination);
break;
}
if (operationResult != null)
{
Log("Operation succeeded: \r\n" + operationResult.RawResult);
}
}
catch (Exception ex)
{
Log("Got error: " + ex.Message);
}
}