ews-managed-api
ews-managed-api copied to clipboard
ExportItems and UploadItems
Hi guys,
Do you intend to implement these two methods in EWS managed API, or will we have to stick with web calls ?
No plan to do this at this time, but if you want to give it a shot you are more than welcome.
Hello, i'm going to implement it. (i'm luke co-worker)
Just to be sure i need to :
- Implement Responses
- Implement Requests
- add new functions to service
Do this sounds right ?
Any insight from you @dclaux @vboctor ?
@XavierDa Yes, that sounds about right. Looking forward to looking at your changes.
Hello, i finished implementing it, but i have a small problem.
It seems that exportItems change ItemIds (can't find any of the itemids i sent in the result), Is there any way to find a link between them ?
One caveat - The typical use case for UploadItems is read data from somewhat large files (as opposed to in-memory buffers) or from a database field. So the EWS Managed API's implementation of UploadItems should stream the data right from its source and serialize it by chunks, so that there is no need to load a full copy of all the data in memory. You can take a look at how file attachments are handled to see an example of the how the API does this.
ExportItems shouldn't change any Id. It's just a dump of what's in a mailbox.
So are you saying that the Ids you get in ExportItems' response aren't the same as the ones you passed in the request? Sounds really weird to me. That said the items in the response should be in the same order as those in the request, so you can match based on ordering.
Ok found my error. I had a misplaced new ItemId.
For uploadItems... i will check how it's done for file attachement and try to get a similar solution. Right now my solution for exportItem returns a byte[] for data, maybe it should use a Stream too ? (so it's easier to implement export => upload solutions ?)
Yes, ExportItems should also use streams.
Thinking more about this - ExportItems needs to be passed a callback method that lets the developer specify the stream for each item in the response. Either that, or introduce an "ExportManager" class that encapsulates the entire logic and exposes an event that lets developers specify the destination stream for each item. I can think of two main ways a developer might want to store what ExportItems produces: 1) one file/database row/field per item, or 2) a single file that stores all items. I think the API should make it easy to do either.
How far did you get with this? @XavierDa
We have a working version here, but we never manage to make a PR due to some slight hiccups on our side.
if you want this you can get it from this pull request https://github.com/OfficeDev/ews-managed-api/pull/109
@XavierDa , are we sure it is working?
I can get the data without issue, but the UploadItem doesn't seem to do anything on the target mailbox / service
Source mailbox Inbox:
Target mailbox Inbox:
Did you check your uploaditem returns ? it may succeed globally but each item may fail.
(fix for my issue in Update2 below)
Did you check your uploaditem returns ? it may succeed globally but each item may fail.
Indeed my bad, there is an error in the response, indicating malformed ID:
Is it possibles IDs from Exchange Online are incompatible with OnPremise ones?
Update: tried from OnPrem to OnPrem, same issue. Realized ItemToUpload ID was not filled, don't know if it was on purpose. But even filling it still shows the issue:
Update 2: I made further tests, and I created a custom folder, and search for that specific folder ID before using it in the itemToUpload. It worked.
It seems what is causing the issue is the "WellKnownFolderName.Inbox".
To conclude: make sure you get the ID by binding the folder in the destination service, not just by specifying a WellKnownFolder in the item to upload.
Hi, I am also using the ExportItems and UploadItems to backup and restore items in outlook. Both are working, however when I use the CreateAction Update to update an existing item, the "pin/unpin" and "mark as read/unread" property of the item in UI is not updated. Though these fields are updated when I use CreateNew as long as the item does not exist in Inbox. Does anyone encountered this issue or anyone who knows how to fix it? Thanks!