SharePoint Calendar reminder service - Part 2

Ok… I’ve been thinking long and hard about this service, and it seems as though SharePoint doesn’t play that nice with recurring events. Seems like my pervious post did nothing with recurring events. This is a problem, especially since I originally wrote this service to notify me of birthdays. I looked into several options in dealing with recurring events, and rather then writing my own translator to get the actual date, and having to find all the errors and oversights, I thought I would use some proven translation to resolve the problem.

I found the easiest solution was to translate the SharePoint recurrence format to the standard iCal format, I found a really good resource here which led me to the actual translation code on codeplex which I just pinched and put in my own code.

Then I found a really good iCal translator by Doulas Day (DDay.iCal)to translate this code to actual usable dates.

I then injected this code and assembly into my SharePoint.Notifier solution and wrapped it all up into a SharePoint solution file (wsp) which made the whole installation process heaps easier.

After running the solution for only a few days, I found the memory usage was going up like crazy. I usually write asp.net applications, so memory is usually the last thing I look at, and only when there is need to do something about it. So obviously, I thought it was my code which was causing the problem. so I when about making all my classes iDisposable, and cleaning up all the objects after I was finished with them.

Attempt number 2, and still the memory was out of control. maybe I did something wrong? So I thought I would use a memory profiling tool to determine what the cause was. Since I use re-sharper, and it is such an excellent product, I decided to use dotTrace 3.1, again another great product from the resharper team. wow, within 20 minutes I was becoming a performance tuning expert. I’ve dealt with a few performance tool in my life, and I must say, this was pretty easy to use.

Much to my surprise, I found the memory leak was not my application at all, but rather in the system namespace. After some deliberation (and heart ache), I found it was actually the SPListItemCollection and all the data being parsed from SharePoint into the SPListItem. it seems as though, even though I was using the SharePoint object model, and not the SharePoint service, it is still retrieving XML from SharePoint to extract the data, and plonk it into the SharePoint objects. After searching through the SharePoint object model for something disposable, I found SPWeb and SPSite are disposable and need to be disposed. And after implementing the change, the memory consumption appears to be better. Still a little high, but at least its not going out of control.

you can download the source here
WSS Solution can be found here

After you deploye the solution, go to the feature folder Calendar.Notifier and modify the Configuration.xml file to select the celendars you wish add this functionality to. Then you need to deploy the solution in the admin site. Then deactivate and re-activate the calendar reminder feature in the site collection features screen. For some reason when you deploy the solution it doesn't load properly until you do this.

Comments

Popular posts from this blog

What good looks like!!

A microservice journey - part 2: what type of micro service are you?

Validation Rules