Question

This is my code for uploading database backup file to SkyDrive. Program is breaking at last line, when it is trying to upload with function UploadWebFile. /Backups is folder on SkyDrive. I am using SkyDrive .Net API Client 2.0.2b.

Exception is:

The request was aborted: The request was canceled.

Is it problem with syntax or it is something else, what is solution?

var client = new SkyDriveServiceClient();

client.LogOn("username", "password");

WebFolderInfo webInfo = new WebFolderInfo();
webInfo.Path = "/Backups";

client.UploadWebFile(@"D:\db.bak", webInfo);
Was it helpful?

Solution 2

Here is solution. Problem was that we cant create WebFolderInfo and give it path manual. We have to reference on folder from WebFolderInfo[] list. For client.Timeout give it big value for big files to have time to upload.

        var client = new SkyDriveServiceClient();

        client.LogOn("username", "password");        
        WebFolderInfo wfInfo = new WebFolderInfo();

        WebFolderInfo[] wfInfoArray = client.ListRootWebFolders();

        wfInfo = wfInfoArray[0];
        client.Timeout = 1000000000;
        client.UploadWebFile(@"D:\db.bak", wfInfo);

OTHER TIPS

Don't think it's a syntax error, but considering that you're talking baout DB backup, I think it's file dimension problem. The maximum size of the file that you can upload to SkyDrive should be something arroung 50MB.

Check the dimension of your file.

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