سؤال

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.

هل كانت مفيدة؟

المحلول

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);

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top