1

I'm trying to upload a file to SkyDrive using Live SDK. It works well except overwriting existing files. Whenever I try to overwrite an existing file I get the error message "The resource file_name already exists.", although I use the Overwrite option:

_liveClient.UploadAsync(
                   FolderId,
                   Filename,
                   MemoryStream,
                   OverwriteOption.Overwrite);

Is there anything else I need to set? I could try handling the error by deleting the file and uploading again but that's obviously not the cleanest way to do that.

filip
  • 1,444
  • 1
  • 20
  • 40

2 Answers2

2

Microsoft admitted here that it's a bug that they are aware of . It will be fixed in the next release. Also, as per answer in that link, the overloaded method works fine:

_liveClient.UploadAsync(
               FolderId,
               Filename,
               MemoryStream,
               OverwriteOption.Overwrite,
               null);
filip
  • 1,444
  • 1
  • 20
  • 40
0

When your upload a file, and a file with the same name already exists in the same location in SkyDrive, the default behavior is for SkyDrive to overwrite the existing file. You are not required to specify OverwriteOption.

From my point of view, there is a problem else where. Try to use another folder and show a little more code.

Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
  • Currently Live SDK for WP7 doesn't allow you to overwrite. It's a bug - see my answer. – filip Oct 09 '12 at 08:23
  • Oh ! a workaround could be to use the Rest API (see http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#uploading_files). – Cybermaxs Oct 09 '12 at 09:00