[IOS ]archiving MCOMessageBuilder objects - mailcore2

To support resending of sent failed mails and viewing email body of mails present in outbox, I am planning to persist the MCOMessageBuilder object in sqlite. Since, MCOMessageBuilder is not Nscoding compliant. How to store MCOMessageBuilder in db ?

You can get the data of the MCOMessageBuilder and using -[MCOMessageBuilder data].
To resend it, use -[MCOSMTPSession sendOperationWithData:].
To view it, use +[MCOMessageParser messageParserWithData:].

Related

Attachments missing on the EWS server for draft email saved via Outlook OfficeJS

I am using the Office.context.mailbox.item.saveAsync method for saving a draft email. This method returns itemId which I later use to make a call to the EWS server to retrieve the email eml content, but the returned eml content is missing some of the attachments.
This is only happening on the Desktop App (Outlook 2013) with cache mode enabled. When using Outlook on the Web it works correctly.
I am using ews-java-api to retrieve the email from the EWS.
Is there a way to know when the email saving is finished?
I can't use the Office.context.mailbox.item.saveAsync.makeEwsRequestAsync because of the 1MB response limitation.
In Cached mode it will take time for the item to sync up to the server. People usually poll until the data they want is there.
Also, they can write a custom property, and check for that property to make sure their item is up to date if necessary.
You can find some details about custom property here: Client Extension Message Object Protocol, Mail App Custom Properties and Mail App Accesses Custom Properties
Is there a way to know when the email saving is finished?
If the following: "Is there a way to know when the email saving is finished?" is your question, than the answer is No. You may try the ugly solution, when you use sub-sequential EWS query with Id you've got from saveAsync in the loop and wait for success. This may take, depend on environment, from a few seconds to like half a minute easily. Not sure if your customers (users) will wait for so long, when add-in finally respond.
You may get more information from the topic: App for Outlook: EWS request failed with item Id returned by item.saveAsync on compose new message
EDIT:
Simple GetItem request can be used as follow ...
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</ItemShape>
<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>
</GetItem>
The request should return ChangeKey if item was created on exchange.

How to attach files using NSSharingService

I am preparing a Mail using NSSharingService. I mainly followed the advice given here: NSSharingService to send email and read email body
Effectively I am calling
[self.emailSharingService performWithItems:shareItems];
where shareItems is an NSArray containing one NSString object (the body) and several NSURL objects (the attachements)
With AppleMail the preparation of the mail works fine (e.g. body & attachments) but unfortunately the attachments are not added if I use another mail client (e.g. Thunderbird, Spark)
Does anyone know how I can achieve the addition of the attachments in other mail clients than AppleMail?

Update single attribute with Restkit

I want to update ONE SINGLE attribute on the Core Data Object and send the change to the server using RestKit.
I see that ResKit is always sending Object with ALL attributes and not only with the changed ones. That makes my app slow(er).
I also see that update response from server should return whole object back to the RestKit which is again slower that it could be (All I need is success/failure response)
Is there elegant solution for this? (I am pretty new to the RestKit)
You can create a request descriptor on-the-fly which includes only the attributes you want to send, you would either simply need to use a mapping operation yourself or be sure to only run one such operation at a time and call removeRequestDescriptor: on the object manager (this could be tricky for you to manage). The alternate is to put the data to upload into a dictionary and upload that, but that isn't ideal.
For the response, the mapping says what to map but it doesn't all have to be there, RestKit will take whatever it can and map that.

GoodData: Deleting and updating metadata objects through API

How do you delete / update a metadata object through the API?
For example Scheduled emails: http://docs.gooddata.apiary.io/#reportsanddashboardsbyemail
In the documentation I see how to create a new one or get existing ones.
How do I delete a Scheduled email?
DELETE https://secure.gooddata.com/gdc/md/PROJECT_ID/obj/OBJECT_ID
For scheduledMail it works fine, but does it work universally?
How do you update a scheduled email? Does PUT work? What request body should I use? Or do I have to delete the old object and create a new one?
For each metadata object the DELETE works. For updating the object use the PUT where the body will be response to the same resource from GET request that you can easily edit and send back using PUT to the same resource. So the workflow will be:
GET metadata object
Update the object body (JSON)
PUT it back on the same resource from which you got it
This works for all metadata objects. You can easily recognised those objects by
/obj/OBJECT-ID
Thanks for the question!

Using NSMutableURLRequest and how to manage response/failure

I am creating an iOS app that consumes web services.
I have a class that makes the connections and stores the response in a variable. It also has a status variable where 1 indicates successful connection.
I have set up an NStimer and a function to check when the connection and download is done and if it was successful.
My question is:
Is this a proper way to manage the connection and its outcome?
any suggestions?
Here is the programming guide from Apple Developer website and it describes how to use NSURLConnection delegate. You can manage the received data in connectionDidFinishLoading: method. Notice that using these delegate methods will load data asynchronously. If you want to handle data synchronously, please try sendSynchronousRequest:returningResponse:error:, but this function should never be call in the main thread.