How to delete or update a scheduled message - ews-managed-api

I am using the EWS Managed API to schedule messages for delayed delivery. I also have a requirement to update or delete messages after they have been scheduled for delivery.
A similar problem is outlined on msdn: Cannot delete delayed delivery emails. I tried the suggestion of instantiating the service without use of autodiscovery, but that did not help. (Though the idea behind the suggestion feels like it's on the right path.)
I can queue the email. I can retrieve the MailMessage item. I can set properties on the item. But whenever I call the Update, or Delete method, on a queued message a Microsoft.Exchange.WebServices.Data.ServiceResponseException is thrown.
I have tested updating and deleting MailMessage items that have been saved but not queued. Both update and delete work as long as message has not been queued.

Related

logic Apps : What are possible reason that an new-email-trigger does not fire or failed?

The office365 trigger when new -email arrives (V3) is my logic Appp trigger condition.
The workflow does following:
Triggered on incomnig e-mails
check if sender is an AD User, if not send to a special Mailaddress
analyse the subject and put informations gother in new mailboydies and
distribute the mail to other mailboxes
I have seen a few cases I don' t understand, what it is the reason for that.
I got a trigger sicceeded but the trigger doe not fired Why?
image1: trigger History
image 2: not Fired Triggers
Screenshot shows succeeded triggers but not fired to start a run.
In this time spawn there was no email in the inbox.
I got a trigger failed ( i cannot reconstruct which mail could the reason).
image3: failed Trigger
for this case I can say nothing i found no e-mail at this time,
but it is possible that there was through Dectivation/Activation of logic app
old not readed mails ttries to trigger.
it was the first trigger after creation of this Logic app for testing
(copied from other subscription).
Can someone say me possible reasons for this 2 situations?
A status of skipped just indicates that the nothing new was found to fire the logic. Because the trigger will do check operation every once in a while even though the mailbox do not receive new email.
I think you do not need to worry about the records under "Trigger history". You just need to check the records under "Runs history". The records under "Runs history" can give a more intuitive picture of what's your logic app going on.

What to do if a RESTful api is only partly successful

In our design we have something of a paradox. We have a database of projects. Each project has a status. We have a REST api to change a project from “Ready” status to “Cleanup” status. Two things must happen.
update the status in the database
send out an email to the approvers
Currently RESTful api does 1, and if that is successful, do 2.
But sometimes the email fails to send. But since (1) is already committed, it is not possible to rollback.
I don't want to send the email prior to commit, because I want to make sure the commit is successful before sending the email.
I thought about undoing step 1, but that is very hard. The status change involves adding new records to the history table, so I need to delete them. And if another person make other changes concurrently, the undo might get messed up.
So what can I do? If (2) fails, should I return “200 OK” to the client?
Seems like the best option is to return “500 Server Error” with error message that says “The project status was changed. However, sending the email to the approvers failed. Please take appropriate action.”
Perhaps I should not try to do 1 + 2 in a single operation? But that just puts the burden on the client, which is worse!
Just some random thoughts:
You can have a notification sent status flag along with a datetime of submission. When an email is successful then it flips, if not then it stays. When changes are submitted then your code iterates through ALL unsent notifications and tries to send. No idea what backend db you are suing but I believe many have the functionality to send emails as well. You could have a scheduled Job (SQL Server Agent for MSSQL) that runs hourly and tries to send if the datetime of the submission is lapsed a certain amount or starts setting off alarms if it fails as well.
If ti is that insanely important then maybe you could integrate a third party service such as sendgrid to run as a backup sending mech. That of course would be more $$ though...
Traditionally I've always separated functions like this into a backend worker process that handles this kind of administrative tasking stuff across many different applications. Some notifications get sent out every morning. Some get sent out every 15 minutes. Some are weekly summaries. If I run into a crash and burn then I light up the event log and we are (lucky/unlucky) enough to have server monitoring tools that alert us on specified application events.

Resend Opt-in email to unsubscribed member using MailChimp API V3.0

I have a situation where I would like to programmatically (re)send a confirmation (opt-in link) email to a member who has unsubscribed.
I know I cannot directly re-subscribe them, but I was hoping there would be a means of at least sending a confirmation email.
Is it possible to trigger the confirmation email for an unsubscribed member in vs 3.0 of the API?
I know I can resend it from the Web UI but I'd really like to accomplish it via an API request when a user who has previously unsubscribed performs some action on the website indicating they'd like to be added again.
Deleting and Adding the member is a last resort, but I would prefer to keep the original account (and its data) in place.
Re-sending an opt-in email for someone who is still in a pending state isn't supported AFAIK, but once the user is unsubscribed, I think if you set them back to pending it will resend the email.
Alternately, I've not found deleting and resubscribing to cause much data loss (if any) so you might try that out too, if the above doesn't work.

Is there a way to modify a Message in the MessageQueue without removing it?

Is there a way to modify a Message in the MessageQueue without removing it?
IDEA here is that an App (app1) sends a message to MSMQ, which APP (app2) listens to MSMQ
and retrieves the message. app2 has to update the data (Message.Body) which will is used
for future reference. Finally app3 will remove it after message is processed.
I am afraid the answer is NO. Messaging provider are not built for this scenario. The only way to "update" a message is to retrieve that message, modify it and put it back again. But note that updated message is another message altogether, not same as the one put by first application.

Getting the Id property of an MSMQ mesage with NServiceBus

I need to get the Id of a msmq message inside of my handler so I can write that Id to a log.
When a message is sent to the error queue an email is sent informing us of a failed message. Once the error that caused the message is resolved we need to use the 'ReturnToSourceQueue' NServiceBus tool to try that message again. Without logging that Id, it would be difficult to track down which message is which when looking through the message queues.
Every where I've looked suggests that Bus.CurrentMessageContext.Id will give me the same Id that's in the Message ID column when looking at the queues in ComputerManagement->Services and Applications->Message Queuing->[Some Queue]->Queue messages. However, those ids don't seem to be the same.
What am I missing?
The reason that the message ID that you see in MMC plugin or Queue Explorer is different is that when the message is "moved" to the error queue, what actually happens is that a new MSMQ message is created with the same body and headers and that is sent to the error queue.
Also, when the processing a message fails, NServiceBus already logs this for you and includes the ID of the message, so that's already done for you.
If you take the ID that was logged and pass that to the ReturnToSourceQueue tool, everything will just work.
The last piece of the puzzle for you is sending an email when a message fails. Now, I'm not sure that that is the wisest idea as you may end up spamming your ops team when a database goes offline or a 3rd party webservice becomes unresponsive. Still, if that's what you want to do, then I'd suggest using an email appender for when errors are logged.
Finally, let me say that we're in the process of building this kind of notification functionality into the Particular Service Platform around NServiceBus. We've got a UI showing errors and allowing messages to be reprocessed coming as a beta in November '13 and the notification functionality will probably be ready towards the end of the year.
It's really a question of whether you want to wait or to build this yourself.
Just create an instance of your bus in your handler:
public IBus Bus { get; set; }
Then use that to get the message id:
this.Bus.CurrentMessageContext.Id
The Bus instance will be injected when the handler is called.
EDIT
Now that I have actually read the question...
The CurrentMessageContext.Id returns what's in the message header under the CorrId field. This can be seen in the Label column in Server Management.
The Message ID displayed in the MessagId column is the message ID as it existed on the sending computer. I am not sure how to access this value from CurrentMessageContext but you should not need to do this to find a local message.