added the code for example by Ted Pattison from http://msdn.microsoft.com/en-us/library/hh134614%28v=office.14%29.aspx