So I know that the code to upload a file to skydrive is
LiveAuthClient authClient = new LiveAuthClient();
LiveLoginResult authResult = await authClient.LoginAsync(new List<string>() { "wl.basic", "wl.skydrive", "wl.skydrive_update" });
if (authResult.Status == LiveConnectSessionStatus.Connected)
{
LiveConnectClient meClient = new LiveConnectClient(authResult.Session);
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile sampleFile = await storageFolder.CreateFileAsync("sample.txt");
await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Sample Content");
LiveOperationResult result = await meClient.BackgroundUploadAsync("me/skydrive/testFolder", sampleFile.Name, sampleFile, OverwriteOption.Overwrite);
}
and the code to make a folder is
LiveAuthClient authClient = new LiveAuthClient();
LiveLoginResult authResult = await authClient.LoginAsync(new List<string>() { "wl.basic", "wl.skydrive", "wl.skydrive_update" });
try
{
var folderData = new Dictionary<string, object>();
folderData.Add("name", "Test Folder");
LiveConnectClient liveClient = new LiveConnectClient(authResult.Session);
LiveOperationResult operationResult =
await liveClient.PostAsync("me/skydrive", folderData);
dynamic result = operationResult.Result;
}
catch (LiveConnectException exception)
{
}
How would get the folder ID from the folder that I made and then upload the file to that location?
LiveAuthClient authClient = new LiveAuthClient();
LiveLoginResult authResult = await authClient.LoginAsync(new List<string>() { "wl.basic", "wl.skydrive", "wl.skydrive_update" });
try
{
var folderData = new Dictionary<string, object>();
folderData.Add("name", "Test Folder");
LiveConnectClient liveClient = new LiveConnectClient(authResult.Session);
LiveOperationResult operationResult =
await liveClient.PostAsync("me/skydrive", folderData);
dynamic result = operationResult.Result;
var folderId = result.id;
/*result is dynamic object, you can get the folder id with id property
operationResult.RawResult will return JSON response with some data related to
that folder */
}
catch (LiveConnectException exception)
{
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.