Orphan Event Receivers SharePoint 2010 - sharepoint-2010

For some reason my feature event receiver still runs after deactivation and uninstall. I have an feature event receiver on my SharePoint 2010 server that runs on a survey list prevent users to delete survey responses. If I deactivated the feature event receiver, I still can't delete responses. Even after I did an uninstall and iisreset, the event receiver was still running. My solution was to run a powershell command that will physically remove the event receiver from the survey list. Once I did that, I was able to delete survey responses from an existing survey. Any idea why even after an deactivation and uninstall I still have an attached event receiver to my survey list?

If you added the Event Receiver to a list in FeatureActivated, you should remove it from that list in FeatureDeactivating.

Related

Send and Save specific emails. Not a sentitem event listener

Edit: I am just going to use an eventlistener. I would delete the post but maybe somebody will find a non eventlistener way to save a sent mailitem before it is received in the sent item inbox.
Issue: Outlook won't receive VBA sent emails until macro completes. If I use wait, sleep, while loops or anything else, the email will not be received. I can't use a Sent Items event listener because I only want specific emails saved to the folder, not all. I individually know how to save from sent items, I know how to send messages. The issue is the delay between sending the email with VBA and it appearing in my Sent Items box. If I saveas before waiting, the email that is saved is the previous email, but if you try to wait, the sent items folder never updates. Any ideas or simple solutions. I might just be dumb.
I have read every forum but haven't found a solution, I had it running at another company but no longer remember how. I use a macro to send very specific emails and do lots of other tasks. I would then like to grab the email I just sent and save it to a folder using vba. The issue is receiving the email in my "Sent Items" folder is delayed. If I try to capture it or wait to receive it, my code never finishes. All solutions I see in the forums are a Sent Item listener / Inbox event listeners, but I don't need that, I know which emails to trigger it on.
One way or another, you'd need to wait for some event to fire, be that Items.ItemAdd on the Sent Items folder, or SyncObject.SyncEnd on the SyncObject - message submission is asynchronous, so no amount of sleep or while loops would help you. You cannot just stop your VBA script and resume it when the message is actually sent since your code is running on the main Outlook thread - if your script pauses, so does Outlook.
You can try using the NameSpace.SendAndReceive method which initiates immediate delivery of all undelivered messages submitted in the current session, and immediate receipt of mail for all accounts in the current profile. Note, calling the SendAndReceive method is asynchronous. SendAndReceive provides the programmatic equivalent to the Send/Receive All command that is available when you click Tools and then Send/Receive.
If you don't need to synchronize all objects, you can use the SyncObjects collection object to select specific objects. For more information, see NameSpace.SyncObjects.
In your VBA code you may also consider using the DoEvents function which yields execution so that the operating system can process other events. DoEvents passes control to the operating system. Control is returned after the operating system has finished processing the events in its queue and all keys in the SendKeys queue have been sent (if any).
DoEvents is most useful for simple things like allowing a user to cancel a process after it has started, for example a search for a file.
Solution, not the solution or used in the past but I settled.
Basically just the event listener solution that everyone in all the forums suggest. I created a separate folder in my Sent Items and use myNameSpace.GetDefaultFolder to set that folder for the VBA sent items.. I send the emails only to that folder and I added the listener to only that folder. This allows me to separate the Sent items and this specific VBA sent emails and then to save them automatically. I am still looking for a way to save the sent Mail Item before the Sent Item Inbox shows it, but I have given up at this point. Thanks for everyone's help. If I find the better answer, I will try to post it along with the code.

Can ConversationID change for existing item in conversation?

We are writing Outlook VSTO add-in and save info about mail items in database. Some features are relying on conversations in Outlook, so we save ConversationID in the database to detect that all messages are from the same thread.
Recently I found that at some point conversationID is changed for the entire conversation! So I have first message with ID
5E2C809C8D7E4BEBA402613311DD8C7B
And then suddenly it becomes
347B0DEB35C68E1EE882EFABE4BCC373
for the next messages. And when I select previous messages they also have this 347 id.
It seems that it broke when I answered an e-mail with changed subject (and it gets out of thread) or after I answered from Win10 mail client. But I can't reproduce this anymore.
Does anyone know in which cases this can happen?
Conversation index can change if the "Thread-Index" MIME header is missing from a message in the conversation. But it will not change for the existing older messages in a conversation. For that to happen, each and every one of them would need to be updated, and if that happened, you should see the updated last modified date.

Event sourcing combinded with deletable data

I want to develop an Emailer microservice which provides a SendEmail command. Inside the microservice I have an aggregate in mind which represents the whole email process with the following events:
Aggregate Email:
(EmailCreated)
EmailDeliveryStarted
EmailDeliveryFailed
EmailRecipientDelivered when one of the recipients received the email
EmailRecipientDeliveryFailed when one of the recipients could not receive the email
etc.
In the background the email delivery service SendGrid is used; my microservice works like a facade for that with my own events. The incoming webhooks from SendGrid are translated to proper domain events.
The process would look like this:
Command SendEmail ==> EmailCreated
EmailCreatedHandler ==> Email.Send (to SendGrid)
Incoming webhook ==> EmailDeliveryStarted
Further webhooks ==> EmailRecipientDelivered, EmailRecipientDeliveryFailed, etc.
Of course if I'd want to replace the external webservice and it would apply other messaging strategies I would adapt to that but keep my domain model with it's events. I want to let the client not worry about the concrete email delivery strategy.
Now the crucial problem I face: I want to accept the SendEmail commands even if SendGrid is not available at that very moment, which entails storing the whole email data (with attachments) and then, with an event handler, start the sending process. On the other hand I don't want to bloat my initial EmailCreated event with this BLOB data. And I want to be able to clean up this data after SendGrid has accepted my send email request.
I could also try both sending the email to SendGrid and storing an initial EmailDeliveryStarted event in the SendEmail command. But this feels like a two-phase commit: if SendGrid accepted my call but somehow my repository was unable to store the EmailDeliveryStarted event the client would be informed that something went wrong and it tries again which would be a disaster.
So I don't know how to design my aggregate and, more important, my EmailCreated event since it should not contain the BLOB data like attachments.
I found this question interesting and it took a little bit to reflect on that.
First things first - I do not see an obligation to store the email attachments in the event. You can simply store the fully qualified name of the files attached. That would keep the event log smaller and perhaps rule out the need for "deleting" the event (and you know that, in an event source model, you should not do that).
Secondly, assuming that the project is not building an e-mail client, I don't see a need to model an e-mail as an aggregate root. I see AggregateRoots represent business-relevant domains, not for a utility task like sending an e-mail. You could model this far more easily using a database table / document that keeps track of what has been sent and what not yet. I see sending e-mails through SendGrid as a reaction to a business event, certainly to be tracked, but not an AggregateRoot in its own right.
Lastly, if you want to accept SendEmail commands also when SendGrid is offline, the aggregate emits an EmailQueued event. The EmailQueuedHandler will produce a line on the read model of the process in charge taking all the Emails in queued state and batch them for sending. If the communication with SendGrid fails, you can either:
Do nothing, the sender process will pick the email at the next attempt
Emit a EmailSendFailed, intercepted by a Handler that will increase the retry count (if you want to stop after a number of retries).
Hope that is sufficiently clear and best of luck with your project.

SharePoint 2010 itemadded event receiver - how to check logs?

I have created a custom SharePoint 2010 Item added event receiver on a document library. I also log all exception which might be fired during this event receiver.
This event receiver fires perfectly fine almost all of the times. There are, however, only a few cases during which the event receiver does not fire. and since the event receiver does not fire I don't see any exception log. These types of events are scattered and not concentrated on a particular timespan of the day.
My question is whether there is some log that I can check on a SharePoint server that will tell me why the event receiver did not fire or probably what went wrong. Thanks in advance.
In my experience, event receivers will just stop when an uncatched exception occurs. So they will not log exceptions themselves.
What you should do is make your event logic exception-proof, so catch everything you can and log it yourself to the ULS.

Using Dday.ical How can I send multiple events with the same start time and duration

When I setup the event using DDay.ical I can successfully send the events to a user's outlook. The problem arises when multiple events are setup at the same time. When this happens all emails are updates to the original task, not new tasks.
I tried adding a name to the event using the .Name property, which results in the event email being an unsupported calendar invite.
Ended up figuring this out through some good old trial and error.
In the end I was not properly setting the UID property to be a completely unique identifier for each event. Changing this to be unique 100% of the time fixed the issue and allowed me to be able to create as many events as I want, any time I want, and have them all appear as separate events instead of updates.