Rise Foundation

Blog Categories


Steven Mierop

As a Lead Technical Consultant at Perficient, I've had the pleasure of designing and delivering custom solutions on SharePoint 2007-2013. I have a strong passion for web application development and the .NET framework. Over the past three years, I have implemented a variety of SharePoint and .NET solutions for clients in a wide range of Industries such as Health Care, Insurance, Pharmaceutical, and Publishing.

LinkedIn LinkedIn Public Profile
Twitter stevenmierop

Posts by this author: RSS

How to Create Visual Studio 2012 Custom Templates

Lately, I’ve been thinking about ways to manage and re-use existing code. Right away I thought of code snippets. Snippets are handy for methods or small segments of code, but what I was really looking for was a faster way to repurpose common class libraries and patterns.

Functionality such as caching, logging, abstracting the SharePoint data layer, etc. are a few examples of what tend to be boilerplate code. It would be great to have a pre-defined “Base” project that can be repurposed (and improved over time) to help speed up SharePoint development.

One way to achieve this is by creating a custom Visual Studio 2012 Project Template. Visual Studio provides a painless process to make this happen. And automatically handles the parameterization of namespaces for you.

Here’s a quick set of instructions to walk you through the process:

Step 1: Find an existing project or create a new one that you would like to use as a template. In this example I called mine “SharePoint.Base”.


Step 2: Export as a template. File –> Export template.


Step 3: Save as Project template.


Step 4: Select Template Options. I named my template “SharePoint Class Library”.


Step 5: Create a new project based on your template.


That’s it! You now have a custom template that can be modified to meet your development needs.

Content Query Web Part – Sort Order from a Calculated Column

​Here’s a quick way to implement custom sort functionality in a Content Query web part. Since the out-of-the-box options only offer ascending or descending alphanumeric sorting, you can use a Calculated Column to provide the necessary logic.

For example, say you have a list called ‘Defects’ that has the following two Choice fields: ‘Impact’ and ‘Status’.

Impact = {“Red, “Yellow”, “Green”}

Status = {“Open”, “Closed”}

The requirement is for the  Impact field to be sorted in the following order: “Red”, “Yellow”, “Green”. All “Open” items should appear before the “Closed” items.

So what to do…?

We can use a calculated field (that returns a Number) to do the work for us. The idea is to assign each possible condition with an integer value.  The higher the number, the higher the sort order.

First, create a Calculated field.  I called mine ‘Sort-Value’.


Next, write a formula to assign each condition a numerical value. I used a combination of ‘IF’ ‘AND’ operators.  More information on how to use calculated formula operators can be found here.


Here’s a closer look:


You can now use the Calculated column to sort the list items. If anyone knows of a different way to accomplish this, please leave a comment below.

Limitation of programming vCalendar Meeting Requests using System.Net.Mail

Programmatically creating Outlook meeting request has been a hot topic for me over the past few weeks. I found myself in a scenario that required me to send a meeting request from a user and was using the System.Net.Mail namespace to do the job.While creating the meeting request, a limitation surfaced as result of the approach I was using. I used the code from the blog below as a foundation to start with.

Although the vCalendar format includes ‘Request’ as part of it’s schema, the ‘flow’ of messages is not the same as if an Outlook meeting request was created directly from the client application. The meeting request will be sent to the recipient with the organizer’s account in the ‘From’ field, but the organizer will not have it on their Outlook calendar.

Will provide the code needed to send Outlook meeting request using the System.Net.Mail namespace. The main drawback of programmatically creating Outlook meeting requests using this technique is the lack of options under Accept/Decline.

Outlook with no Options under Accept and Decline

After doing some research, I discovered when the organizer creates the request from their Outlook client, a UID (unique ID) is created.The meeting request that ends up on the recipients calendar references that same UID as the originator’s.This results in the additional options under Accept, Tentative, and Decline.

When creating a meeting request from code however, the UID object is instantiated at runtime and does not get associated with the originator at all.Therefore, Accepting/Denying with any follow up message is not possible.

If both the originator and recipient(s) happen to be using the same Exchange server (2007 or 2010), a solution to the above problem can be found via the Exchange Web Services Managed API. Here is a link that will get you started.

Speed up Development with Exchange Web Services Managed API

We’ve all experienced it before, those “Wow, I can’t believe it’s that easy” moments. Exchange Web Services Managed API makes sending emails, creating appointments, querying folders/calendars, and generating meeting requests extremely simple.When it comes to programmatically duplicating Outlook functionality (given Exchange is running the show), the Exchange Web Services Managed API is definitely worth looking into.

There’s some good documentation online, but the object model is easy enough to get started with. Instead of writing a blog that highlights the features of this API, I’ll instead show you how I put it to use for areal use case.

I was working on a project that required an Outlook meeting request to be sent to a user programmatically.My first approach was to use the System.Net.Mail namespace to utilize the SmtpClient object.This works great for sending basic email messages, but did not deliver the ’round-robin’ functionality I was looking for.For example, the recipient of the SmtpClient’s meeting request did not have the ability to Accept/Decline or purpose a new time to the organizer (refer to this blog post for the explanation).Another downside is the requirement of having to create proper formatted vCalendar as well as alternate views.

Since the organization was using Exchange 2010 (ewsm 1.1 will also work with Exchange 2007), I opted for the Exchange Web Services Managed API.This made for less code that was easier to read and worked exactly as I needed it to.

Here’s a quick demonstration on how to create an Outlook meeting request when using the Exchange Web Services Managed API.

After downloading the API, add a reference to the assembly.

Page directives

By default, the ExchangeService object will use the credentials of the logged in user to establish a connection, so it is not necessary to create a new ‘NetworkCredential’ object (I’ll get to why took this route in a moment).In some cases this might be just what you need.In my situation I chose to use the credentials of a service account and which has the role of “ApplicationImpersonation”.This way, when the appointment is created, it will be appear on the impersonated user’s calendar first.

From the point of view of any attendees, it will look just like the meeting request was generated from the impersonated user’s Outlook client.The options to Accept/Decline with message back to the organizer will now be available because all parties are referencing the same UID.It is in the new ‘NetworkCredential’ object that I’m using the service account.This account has permission to impersonate all users within the organization.This method can be modified to pass in a string of a user’s email address to be impersonated.

Send Email Method with no Parameters

In Conclusion

The Exchange Web Services Managed API is something I wish I would have discovered much sooner.It’s a slick way to send everything from simple email messages to meeting requests and can encapsulate most of the functionality of an Exchange client.

Useful Links

How to Create an Outlook Appointment using Nintex Workflow 2010

Nintex Workflows 2010 is a great alternative to manually create workflows using Visual Studio or SharePoint Designer.Business users now have the ability to create some pretty intricate workflows directly from the browser.

The installation for Nintex Workflows 2010 is very simple, consisting mainly of deploying a solution file and activated a few features. There was however one issue in particular that took more time than anticipated to solve.In order to use the ‘Create Appointment’ workflow action, there are few configurations that must be completed first.

Create Appointment
Appointment Config

The ‘Create Appointment’ workflow action will call the exchange web service, pass in the credentials of a user that has write access to the target Outlook calendar, and add a new appointment to that calendar.

When I attempted to configure this, I was receiving an error in the SharePoint logs referring to “The root of the certificate chain is not a trusted root authority”.

You need to install the root certificates into ‘SharePoint Root Authority’.SharePoint out of the box only trusts its own self signed certificate called ‘local’.

Nintex support provided a good PowerShell command which will add all the root certificates on the local machines into SharePoint.

foreach ($cert in (Get-ChildItem cert:LocalMachineRoot)) { if (!$cert.HasPrivateKey) {New-SPTrustedRootAuthority -Name $cert.Thumbprint -Certificate $cert } }

The next step is to ensure the configurable user credentials (source user) have write access to the calendar that will have the appointment added to it.

This can be done in one of two ways. The first is to have the target user provide the source user with write access to their calendar.


The second is through the Exchange Management Shell.

The first command can be used to confirm the changes have taken place as it will list all users associated with the respected calendar along with their permission levels.

The following command will manually grant editor permission to a user.
You should now be able to use Nintex Workflow to add appointments to a user’s calendar.

Email Received Event Receiver Requires a SharePoint Timer Reset

While working with a couple different types of event receivers in Visual Studio 2010, I noticed an inconsistency between the ‘item added/adding events’ and the ’email received’ event receiver in terms of deployment from Visual Studio.When deploying from Visual Studio via the F5 key everything worked as expected with the item added/adding events.This is also true for the latter, but only upon the very first deployment.I made a few minor changes to my code, redeployed the event receiver (which includes an automatic IIS reset), and discovered no changes had been made.The original code from the first deployment of the ‘Email Received’ event receiver was firing instead.

After doing some researching I learned that the ‘SharePoint 2010 Timer’ contains it’s own cached copy of the original dll. An IIS reset alone will not update the Timer’s cache.The solution is to restart the SharePoint 2010 Timer service after each IIS reset. This will refresh the timers cache with the most current assembly.

The blog below contains some great tips on debugging SharePoint Timer jobs.

Email Configuration within a SharePoint 2010 Development Environment

There have been countless blogs written on this topic, yet I always seem to be spending way too much time configuring Incoming and Outgoing mail in my SharePoint 2010 development environment.I often find myself wishing the author included a few screen shots of their configuration settings so I could better compare them to my own.The purpose of this article is to create one easy to follow, holistic view of setting up Incoming/Outgoing mail.The goals I wanted to achieve are as follows:
  1. From within my local development machine, send an email from amail client such as Outlook or Windows Mail to an ‘Incoming Email’ enabled list in a SharePoint 2010 site.
  1. Programmatically or through SharePoint ‘Alerts’ have emails sent from SharePoint to my inbox on a local mail client.




User Name: Administrator

Virtualization Software: VMware

Operating System: Windows Server 2008 R2

SharePoint Version: SharePoint 2010

Services used: SMTP and third-party POP3 by Visendo (free version).


  1. Setup SMTP
  1. Install Visendo and follow install and configuration instructions.
    1. Update Visendo.
  1. Configure Visendo.
  2. Download Windows Live Mail or Outlook and configure.
  3. Configure Incoming/Outgoing email in SharePoint 2010.

First, make sure the SMTP service is installed and running on your machine.Next, open Internet Information Services 6.0 Manager.You’ll notice my Domain Name is simply that of the host name of my machine. Icreated an alias called “WIN-SHAREPOINT.LOCALHOST”.

Right click on [SMTP Virtual Serve #1]and select Properties.I have mine configured so that IP address has (All Unassigned) selected


Go to the ‘Access’ tab and select ‘Relay’.

Select ‘All except the list below’ and click OK.

Since Windows Server 2008 does not include a POP service, you’ll have to download one from a third-party vendor.Visendo provides a great POP3 service that is not only easy to configure, but is also free.

Install POP3 service from

Follow the installation/configuration steps outlined in there PDF.


Make sure in install the updates before you begin.Below is how I have mine set up.

The email address I used was, Administrator@win-sharepoint.localhost.

Please note: Over time you are most likely to change locations or get assigned a new IP address.When this happens you must update your IP address in the following locations:

  1. Mail Client
  1. Visendo configuration file
  1. Visendo GUI





At this point double check that all necessary services have been started.

Outlook/Windows Mail configuration

For either Outlook or Windows Mail, upon the initial setup process, you will want to select ‘Manually configure mail Server’ and use POP3.

You might get prompted for login credentials.

Set up for Windows Mail

Go to ‘Accounts’ tab –> properties

Please Note: Windows Mail worked while using the actual name of the server whereas Outlook required the actual IP address.

Make sure when you’re prompted for your log in credentials you enter in the account name and password that is in Visendo POP3 Server. If you don’t, you may receive an error message.The log files located in the Visendo directory will provide some useful information if additional trouble-shooting is required.


Configure Incoming mail.

Enable a list to receive email.

Enable your list to receive incoming email.

If you’re not using an Active Directory and would like to add/modify user email accounts, you can easily do this in code via a small console app.

Useful blogs that will fill in any gaps.