WP7 + Live SDK - file overwrite doesn't work - windows-phone-7

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.

Related

check if file exist on Sharepoint Online by File Name with Power Automate

I am trying to create a flow in Power Automate Cloud that allows me to extract some files from Google Drive and copy them to a Sharepoint folder. But before copying it, it has to check by the file name, that the file does not already exist in the sharepoint folder. I have managed to do the whole flow, except the checking.
I would be very grateful for your help.
Thank you very much. Best regards.
A File exists action doesn't currently exist but you can use the Get file metadata using path action from the SharePoint connector to do the same sort of thing.
This flow below shows you an example of what you can do ...
For demonstration purposes, I've created an array with a list of file names (full path required) that I will then test the existence for.
One of those files doesn't exist.
I then loop through each one of those and try and get the metadata for each file.
If the resulting statusCode from the call to get the metadata is not equal to 200, then we know the file doesn't exist.
Examples ...
To make this work however, you need to make sure that the Condition step will execute after the metadata call no matter what the result.
Do this by making sure the Configure run after settings are correct ...
So after all of that, all you need to do is deal with the true and false sections of the condition.

RDOMail.SaveAs sometimes doesn't work over a UNC

I have a C# Outlook add-in that is using the Redemption library.
This add-in, among other things, copy the selected mail to a share somewhere on the network.
It usually works pretty well but sometimes, the .msg file on the share seems to be corrupted. It cannot be read by the service that tries to process it. Double clicking on it shows this message: "Cannot read the item".
Sometimes, I can see an error message:
SaveEmail - System.Runtime.InteropServices.COMException (0x8007000):
Error in StgCreateDocFile: 0x8007000 at
Redemption.IRDOMail.SaveAs(String Path, Object Type) at
XYZNameSpace.Email.SaveEmail(...)
Here the code that save the mail to the share:
// Save the mail in a temp local file first
mailItem.SaveAs(temppath, Outlook.OlSaveAsType.olMSG);
(... some processing ...)
// Reload the mail
RDOMail rm = rdoSession.GetMessageFromMsgFile(temppath);
// Save it again on a share
rm.SaveAs(filePathName, Outlook.OlSaveAsType.olMSG);
Note 1 : I don't know why the mail is first saved locally!
Note 2 : It is using an older version of Redemption (2015).
Note 3 : The size of the message doesn't seem important. However, they are
usually between 2 and 15 MB.
Many thanks in advance.
IStorage API does not really like remote drives - there is no way for the storage sharing features to work.
Opening and saving the message the second time really does not make much sense - why not simply copy the MSG file using the file system API?

Xamarin.Auth 1.5.0: Google Drive: Cannot Name or Update Uploaded File?

I have successfully uploaded and downloaded files and downloaded files metadata
from OneDrive and Dropbox using Xamarin.Auth 1.5. I have done all of this for Google Drive except when
I upload a file I cannot name the file (shows as Untitled) and I cannot update
the file once it is uploaded.
Below is code for uploading a file (creating) initially:
Data for the file is in stream. Scope is https://www.googleapis.com/auth/drive.
URI uri = new Uri("https://www.googleapis.com/upload/drive/v3/files?uploadType=media");
OAuth2Request requestUpload = new OAuth2Request("POST", uri, null, (Account)authAccount);
requestUpload.AddMultipartData("body", stream, "application/json", dataFileName);
var responseUpload = await requestUpload.GetResponseAsync();
To update the file, I have tried adding the fileid to the url after files (e.g. files/fileid) and
I received System.Net.HttpStatusCode.NotFound and I know that the fileid is correct because I was
able to download the file using the same fileid. With the fileid, I also tried to use method PATCH
but I received a Xamarin.Auth error.
To rename the file, I have tried using two AddMultipartData, one for data and the other for
metadata (name) with correct formatting and all of the AddMultipartData metadata is added
inside the file with the body data. I tried adding both data and metadata in one AddMultipartData
with the same result as using two.
For both rename and update, I have tried all types of combinations, e.g. different uploadTypes, without
/upload, method PUT, IDictionary parameters, just to name a few.
Does anyone know how to do this? Thanks for any help or suggestions.
Xamarin.Auth has little to do with google drive APIs. It merely gets token for you.
All I can think of is that Xamarin.Auth intercepted some exception during PATCh and re-throw as Xamarin.Auth exception.
I suggest - issue on github. And ping me in community slack.

Download large file from Skydrive to Windows Phone 7

Am having some trouble with the SkyDrive download process and hoping you can help me.
Following the standard SkyDrive API & examples, I've set up a page that browses the SkyDrive folder structure, lets User click on a file, prompt to download, and it all works correctly.
Where I'm having trouble is when the file downloaded is large, I get the OutOfMemoryException thrown at around the 100Mb mark.
Dennis speaks on this problem here http://dotnet.dzone.com/articles/2-things-you-should-consider but it relates to a direct URL download, not via the SkyDrive architecture.
I've tried extracting the URL from SkyDrive and doing the direct download that way but haven't had any success.
Here is the code I'm using - the "item" object is of type SkyDriveItem, having iterated through a folders content and selected this file.
LiveConnectClient downloadClient = new LiveConnectClient(App.Session);
try
{
downloadClient.DownloadCompleted += new EventHandler<LiveDownloadCompletedEventArgs>(downloadClient_DownloadCompleted);
downloadClient.DownloadProgressChanged += new EventHandler<LiveDownloadProgressChangedEventArgs>(downloadClient_DownloadProgressChanged);
downloadClient.DownloadAsync(item.ID + "/content", item);
This will work fine when the file isn't too large, but as mentioned, select a big file (>100Mb) and it dies with the OutOfMemory exception.
Any pointers?
Thanks in advance
Resolved - While I was never able to use the downloadClient.DownloadAsync() method to download large files, playing with the downloadClient.getAsync() and using the Pre-Authenticated URL via a regular Stream downloader does the trick.

Ruby - Working with Mechanize::File response without saving to disk

I'm working on my first ORM project and am using Mechanize. Here's the situation:
I'm downloading a zip file from my website into a Mechanize::File object. Inside the zip is a file buried three folders deep (folder_1/folder_2/file.txt). I'd like to pull file.txt out of the zip file and return that instead of the zip file itself.
My first thought was to use zip/zipfilesystem. I can do this fine if I save the file to the disk first and use Zip::ZipFile.open(src) but can anyone tell me how/if it is possible to send it over straight from the Mechanize::File.body.
My gut says this has to be possible and I'm just missing something basic. I tried...
zipfile = Mechanize::File.body
Zip::ZipFile.open(zipfile)
...but from what I can tell Zip::ZipFile is only set up to locate a source from a filesystem.
Any direction would be very appreciated and let me know if there are any questions
Thanks in advance
Rob
It seems what you want to do is not possible with rubyzip. From rubyzip library's TODO file:
SUggestion: ZipInputStream/ZipOutputStream should accept an IO object in addition to a filename.

Resources