<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Building your own Windows Live Messenger Events Agent</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/c4f/images/1837770_100.jpg</url>
		<title>Channel 9 - Building your own Windows Live Messenger Events Agent</title>
		<link></link>
	</image>
	<description>



&amp;nbsp;

This articles shows how to build a Windows Live Messenger Add-in that connects to Windows Sharepoint Services.




Paul-Valentin Borza
Paul&#39;s Blog

Difficulty: Intermediate
Time Required: 
1-3 hours
Cost: Free
Software: Visual Basic or Visual C# Express Editions,
Windows Live Messenger, Windows Sharepoint Services 2.0 with Service Pack 2

Hardware: None
Download: Download








Summary 
The guide takes you on your new text-based adventure, as you&#39;ll learn to build a little gadget that will answer questions instead of you. This pretty piece of software is nothing more than a Windows Live Messenger Add-In that will register people for events
 that are tracked using Windows SharePoint Services. In the end, you&#39;ll be able to activate an agent on your messenger that will interact with your friends in live scenarios using text messages. 
Introduction 
Microsoft Windows SharePoint Services is a versatile technology that people can use to increase the efficiency of business processes and improve team productivity. Let&#39;s see how we can extend this wonderful technology: you are probably spending almost all
 your time online and using Windows Live Messenger to talk to your friends; more, you may be a very organized person that keeps track of every event (e.g. movie nights, snowboarding weekends etc.), so why not let your friends register for your events in a totally
 unique way. Sounds good? You&#39;ll even be able to supervise the conversation and supply answers to questions that your agent is not prepared to answer.
 
Prerequisites 
Please download Windows Live Messenger and install it on your computer if you have not done so already. With Windows Live Messenger version 8, you can even talk with your Yahoo! friends; we&#39;ll talk about
 Windows Live Messenger and Yahoo! Messenger later on.
I hope you are already using 
Visual Studio Express 
C# or VB since you&#39;re on the Coding4Fun web site (you&#39;re ok with any choice, as the sample is available is both languages).
You&#39;ll also need a place to set up your Windows SharePoint Services; depending on your mood, two options are available: 

You have Windows Server 2003 on your developer or on a near-by networked machine: just download

Windows SharePoint Services with Service Pack 2 and go with the default installation.
You just don&#39;t want to install something new, or your machine is not running Windows Server 2003: you are lucky, because Microsoft and its partners offer you a

Hosted Windows SharePoint Services 2.0 Trial, which is more than enough to get you started.

I personally tried them both and the project worked properly, so it&#39;s up to you. Now that you have everything up and ready, let&#39;s get started: it&#39;s Coding4Fun time! 
Getting Started with Windows Live Messenger Add-Ins 
From a developer&#39;s perspective, Windows Live Messenger delivers a great instant messaging platform that provides support for custom add-ins through its
Messenger Add-In API. However, this is not available out of the box; to take advantage of this feature, we must explicitly tell Windows Live Messenger that we want to use add-ins by tweaking
 a registry key.
Open the Registry Editor and set HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger\AddInFeatureEnabled to a
DWORD entry with the value equal to 1. It&#39;s time to check whether the change in the registry caused the desired effect in your
Personal Settings, as illustrated in [Fig. 1]. A new tab called Add-ins should be visible to you. 


[Figure 1] 
Getting Started with Windows SharePoint Services 
Here, I&#39;ll try to make you understand how Windows SharePoint Services works. Please excuse me in case you find these obvious, or I&#39;m repeating myself; it&#39;s better to clear things out from the early stages than getting into code and not understanding the
 basic concepts. 
Windows SharePoint Services is designed as a platform to support different types of sites, also named templates. Natively installed unique types in Windows SharePoint Services include the STS type, which defines the Team Site, Blank Site, and Document Workspace
 configurations, and the MPS type, which defines the Basic Meeting Workspace, Blank Meeting Workspace, Decision Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace configurations; throughout the tutorial, we are going to work only with
 Team Web Site and Basic Meeting Workspace.
Let&#39;s organize your default Team Web Site to be ready for use in the upcoming custom add-in; navigate to your default web site location, as shown in [Fig. 2]. 


[Figure 2] 
Notice that the page contains several panels named Announcements, Events and Links; in SharePoint terms, these are called lists. We are going to work only with the
Events list; you are not constrained to work only with these predefined lists, you can create your own or use other predefined lists at anytime; just needs a little more investigation from your side. 
Adding a New Event to the Events List 
It&#39;s simple to add a new event; just click Add new event below the 
Events list. You&#39;ll have to complete a three-page process in order to create a valid event. 

Be sure to populate every field, regardless of what the red star character tells you; the Windows Live Messenger Add-In that we are building is going to use all of them. I have designed the add-in so that it works only with non-recurrent events. You are
 welcome to extend it to also work with recurrent events; I&#39;ll even tell you where you should modify the code to achieve that. Please consider special attention to the bottom
Workspace check box.


[Figure 3] 
You have to create a Meeting Workspace web site that associates with the event that you are currently adding. It&#39;s the only way you can keep track of attendees and other details. If you don&#39;t do this, you won&#39;t be able to register people for events or view
 attendees. Click Save and Close. Since you checked the Workspace box, you will be taken to the second page where you can specify details (web site title, web site location etc.) for the Meeting Workspace. Leave everything as it is and click
Ok. Notice that the Meeting Workspace that you are creating will be a sub-site of the site where the
Events list is located. You are now starting to understand how Windows SharePoint Services works.
You are now going to select the template for this Meeting Workspace. Go with the
Basic Meeting Workspace; this way, the predefined lists are already created for you, instead of a blank web site. Click
Ok.
That&#39;s it! A new event that uses a Meeting Workspace should take you to the new workspace web site, like in [Fig. 4]. Again, you can see that the page contains several panels named Objectives, Attendees, Agenda and Document Library; these again are lists.
 At this point you got the idea: Windows SharePoint Services is made up from different types of sites (or sub-sites), and that each site (or sub-site) contains different types of lists depending on the template it&#39;s using.
 


[Figure 4] 
The Attendees list already contains the email of the user who created it (that&#39;s me). When a friend of yours registers for an event (e.g. Microsoft Academic Tour), you should be able to see its email together with its response here. Every event
 has its own Meeting Workspace, so don&#39;t expect to see emails for all events here. Return to the Team Web Site Home (by clicking the
Up to Team Web Site link located in the top-right corner) and repeat these steps as many times it&#39;s necessary. For example, you should add movie nights and snowboarding weekends as events; be sure to set up the occurrence date correctly as this is
 quite important when querying for events that occur within a week, month or year time. 
Building the Windows Live Messenger Add-In 
The current version of messenger provides only text message support for add-ins, although you have probably already seen that it&#39;s more than capable of handling sound and video when communicating with your friends; nevertheless it&#39;s enough for what we intend
 to build. Fire up your code editor, we&#39;re a step closer from writing code!
The add-in will be able to: 

Say hello to a contact with whom you have not talked with since the add-in was started.
Detect the status (e.g. busy) of a contact. Show upcoming events based on predefined time intervals: week, month, year and all.
Show details for events. Register contacts for events. Unregister contacts for events. Change your personal status message according on how many contacts have been registered. We won&#39;t change it when a contact unregisters; we don&#39;t want to make bad commercial.
Several basic requirements need to be met in order for an add-in to function as expected. Please note that they are already done and included in the sample. However, it&#39;s better for you to understand how it actually works and not just find them somewhere
 in the sample and wonder why did I do that:  

The add-in needs to use the MessengerClient.dll binary, so add a reference that points to it; it can be found in the default installation location
%ProgramFiles%\MSN Messenger\MessengerClient.dll. Add-ins run under 
Code Access Security (CAS) and are not allowed to call any web service. Since our primary purpose is to work with Windows SharePoint Services web services, we need to override this behavior. We can achieve that by installing the assembly in the
Global Assembly Cache (GAC); assemblies deployed in GAC must be
Strong-Named Assemblies.

To digitally sign the assembly, go to Project Properties &amp;gt; Signing &amp;gt; Sign the assembly and check the box; choose or create a new strong name key file.
To install the assembly in the GAC you should use the developer tool named 
gacutil which is easily available in the Visual Studio 2005 Command Prompt. I used the build events to automatically install my assembly: go to
Project Properties (in C#) or Project Properties &amp;gt; Compile (in VB) &amp;gt; Build Events &amp;gt; Post-build event command line and enter
&amp;quot;$(DevEnvDir)..\..\SDK\v2.0\Bin\gacutil.exe&amp;quot; /i &amp;quot;$(TargetPath)&amp;quot;. From now on, every time there is a successful build, the output assembly is automatically installed in the GAC for you; be sure to compile the project at least once before using the add-in
 with the messenger.
The add-in is an assembly that contains a class that implements the Microsoft.Messenger.IMessengerAddIn interface. The messenger must know exactly what class to use, so the assembly name must be in
Namespace.ClassName.dll format, where ClassName is the class that we talked about.
Exchanging Text Messages 
By this time, it&#39;s clear that we are going to work with many text messages; it&#39;s always better to keep text that you&#39;re probably going to modify in the near future (you may even want to localize the messages in your language) in resources. We have several
 types of text messages, which all are located in Resources.resx: 

The 1st table displays the commands that make the add-in take action; call them incoming text messages:



Name 
Value
Details




ITextMessage_AllEvents 
show events
Request to see all upcoming events.


ITextMessage_YearEvents
show year events
Request to see all upcoming events in a year time.


ITextMessage_MonthEvents
show month events
Request to see all upcoming events in a month time.


ITextMessage_WeekEvents
show week events
Request to see all upcoming events in a week time.


ITextMessage_EventDetails
show details for event [event_id]
Request to see details for a selected event.


ITextMessage_RegisterForEvent
register for event [event_id]
Request to register for a selected event.


ITextMessage_UnregisterForEvent
unregister for event [event_id]
Request to unregister for a selected event.


ITextMessage_Help
help
Request to help.




The 2nd table displays the responses that the add-in will send back in reply to the previous incoming text messages; call them outgoing text messages:



Name 
Value
Details




OTextMessage_Welcome
Hy {0}, I&#39;m the Events Agent (*). Please ask me something like &amp;quot;show events&amp;quot;, &amp;quot;show month events&amp;quot; or &amp;quot;help&amp;quot; etc.
Show that the add-in is alive and your friend is welcome to use it.
{0} - your friend&#39;s name.


OTextMessage_EndWelcome
I can see that you are not busy, so why not register for one of the events...
When your friend&#39;s status is other than busy.


OTextMessage_BeginEvents
You are welcome to participate in {0} event(s): 
{0} - number of events that matched your friend&#39;s query.


OTextMessage_EventDescription
Event {0} - {1}; 
{0} - event id;
{1} - event title.


OTextMessage_EndEvents
You can view details and register for any event by saying something like &amp;quot;show details for event 2&amp;quot; and &amp;quot;register for event 2&amp;quot;. Hope you register!
Show a tip to remind your friend how it can register for events.


OTextMessage_ZeroAvailableEvents
I&#39;m sorry , but no event matched your query... Please try to enlarge the time span.
When there is no event available that matched your friend&#39;s query.


OTextMessage_EventDetails
Event {0} - {1} takes place on {2} in {3}.
{0} - event id;
{1} - event title;
{2} - event date;
{3} - event location.


OTextMessage_Help
You can talk to me by saying: show events, show year|month|week events, show details for event 2, register for event 1, unregister for event 2, help.
Show all available commands that the add-in is prepared to answer.


OTextMessage_RegisteredForEvent
You have been successfully  registered for event {0} - {1}.
{0} - event id;
{1} - event title.


OTextMessage_NotRegisteredForEvent
You don&#39;t seem to be registered for event {0} - {1}.
{0} - event id;
{1} - event title.


OTextMessage_UnregisteredForEvent
:-O It&#39;s a great event! I&#39;m sorry you do not wish to attend anymore. You have been unregistered for event {0} - {1}.
{0} - event id;
{1} - event title.


OTextMessage_InvalidEvent
Sorry, you wanted to perform an action on an invalid event. Try to query for events first, like &amp;quot;show events&amp;quot; etc.
When your friend uses an invalid event.


OTextMessage_Exception
Ooops!  something unexpected happened while processing your request. The action was not completed. Use &amp;quot;help&amp;quot; in case you have any questions. Please try again later.
When an exception occurred; it can happen.



In case you&#39;ve seen awkward group of characters like  :-O  etc. and are wondering what they are, I&#39;ll tell you that they are emoticons; and yes, the messenger translates them into cool pictures.

The 3rd table displays Windows Live Messenger related customization:



Name 
Value
Details




MessengerAddIn_Description
Windows Live Messenger &amp;#43; Windows SharePoint Services Events
The description of the add-in.


MessengerAddIn_FriendlyName
Events Agent
The friendly name of the add-in.


MessengerAddIn_PersonalStatusMessage
Register For Events Now!
Your default personal status message when the add-in starts.


MessengerAddIn_PlusOnePersonalStatusMessage
&amp;#43; {0} Person(s) Registered! Registration Is Open!
Your personal status message when you have at least one person registered.
{0} - number of registered friends.




The 4th table displays Windows SharePoint Services related customization:



Name 
Value
Details




SharePoint_AttendeesListName
Attendees
No need to change in case you went with the default installation.


SharePoint_EventsListName
Events
No need to change in case you went with the default installation.


SharePoint_MeetingSeriesListName
Meeting Series
No need to change in case you went with the default installation.


SharePoint_ServerName
http://sharepoint.borza.ro
Modify to target your Windows SharePoint Services server name or web site that contains the Events list.




The following rule applies to all text messages that are sent in and out the network: a text message can have only 400 characters; in case a reply exceeds this limit, it won&#39;t send the text message, and you&#39;ll just wonder what happened. Take into account
 that a large number of events may increase the size of a query reply considerably. In case you have many events, you&#39;ll have to create a paging mechanism that meets your needs. 
Consuming Windows SharePoint Services Web Services 
There are many web services that can be used to work remotely with a deployment of Windows SharePoint Services: Administration, Alerts, Document Workspace, Forms, Imaging, List Data Retrieval, Lists, Meetings, Permissions etc; we are going to learn how to
 use Lists and Meetings web services, since these are the only ones we need. When adding web references to the web services, make sure you enter the URLs like these:
http://ServerName/_vti_bin/Lists.asmx?WSDL and http://ServerName/_vti_bin/Meetings.asmx?WSDL. I know that you are eager to write some code; hang on, we are just one paragraph away from coding. 
Looking at the Windows Live Messenger Add-In Code 
I thought I would never reach the coding stuff... we&#39;ll start by looking at the way the add-in comes to life. In
MessengerAddIn.cs or MessengerAddIn.vb, the class MessengerAddIn (to remind you, the assembly name is EventsAgent.MessengerAddIn.dll) is implementing the
Microsoft.Messenger.IMessengerAddIn. 
Visual C# 

&amp;nbsp;&amp;nbsp;&amp;nbsp;14&amp;nbsp;public class MessengerAddIn :
IMessengerAddIn 
&amp;nbsp;&amp;nbsp;&amp;nbsp;15&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private MessengerClient MeClient; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;17&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private System.Collections.Generic.Dictionary&amp;lt;String,
Conversation&amp;gt; People = 
&amp;nbsp;&amp;nbsp;&amp;nbsp;19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; new Dictionary&amp;lt;string,
Conversation&amp;gt;(); 

Visual Basic 

&amp;nbsp;&amp;nbsp;&amp;nbsp;14&amp;nbsp;Public Class MessengerAddIn 
&amp;nbsp;&amp;nbsp;&amp;nbsp;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Implements IMessengerAddIn 
&amp;nbsp;&amp;nbsp;&amp;nbsp;16&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private MeClient As MessengerClient 
&amp;nbsp;&amp;nbsp;&amp;nbsp;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private People As Dictionary(Of
String, Conversation) = New Dictionary(Of 
String, Conversation)() 

Any class that implements this interface must also implement its Initialize method. The
Initialize method is the first one which gets called when you click 
Turn on &amp;quot;Events Agent&amp;quot;, as in [Fig. 5]; and receives the Windows Live Messenger client as an argument, which is saved in a local variable for use later on. One should use the initialization to properly change the friendly name, description and personal
 status message. The project only uses one messenger event, which is fired up each time a new text message arrives; in case you decide to use other events, just uncomment them.
 
Visual C# 

&amp;nbsp; &amp;nbsp;25 public void Initialize(MessengerClient messenger) 
&amp;nbsp; &amp;nbsp;26 { 
&amp;nbsp; &amp;nbsp;27 &amp;nbsp; &amp;nbsp; MeClient = messenger; 
&amp;nbsp; &amp;nbsp;28&amp;nbsp; 
&amp;nbsp; &amp;nbsp;29 &amp;nbsp; &amp;nbsp; //Messenger Add-In friendly texts 
&amp;nbsp; &amp;nbsp;30 &amp;nbsp; &amp;nbsp; MeClient.AddInProperties.FriendlyName = Resources.MessengerAddIn_FriendlyName; 
&amp;nbsp; &amp;nbsp;31 &amp;nbsp; &amp;nbsp; MeClient.AddInProperties.Description = Resources.MessengerAddIn_Description; 
&amp;nbsp; &amp;nbsp;32 &amp;nbsp; &amp;nbsp; MeClient.AddInProperties.PersonalStatusMessage = 
Resources.MessengerAddIn_PersonalStatusMessage; 
&amp;nbsp; &amp;nbsp;33&amp;nbsp; 
&amp;nbsp; &amp;nbsp;34 &amp;nbsp; &amp;nbsp; //Messenger text events 
&amp;nbsp; &amp;nbsp;35 &amp;nbsp; &amp;nbsp; MeClient.IncomingTextMessage &amp;#43;= 
&amp;nbsp; &amp;nbsp;36 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new EventHandler&amp;lt;IncomingTextMessageEventArgs&amp;gt;(this.IncomingTextMessage); 
&amp;nbsp; &amp;nbsp;37 &amp;nbsp; &amp;nbsp; //MeClient.OutgoingTextMessage &amp;#43;=  
&amp;nbsp; &amp;nbsp;38 &amp;nbsp; &amp;nbsp; // &amp;nbsp;&amp;nbsp; new EventHandler&amp;lt;OutgoingTextMessageEventArgs&amp;gt;(this.OutgoingTextMessage); 
&amp;nbsp; &amp;nbsp;39 &amp;nbsp; &amp;nbsp; //MeClient.ShowOptionsDialog &amp;#43;= new EventHandler(this.ShowOptionsDialog); 
&amp;nbsp; &amp;nbsp;40 } 

Visual Basic 

&amp;nbsp;&amp;nbsp;&amp;nbsp;24&amp;nbsp;Public Sub Initialize(ByVal messenger
As MessengerClient) Implements IMessengerAddIn.Initialize 
&amp;nbsp;&amp;nbsp;&amp;nbsp;25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient = messenger 
&amp;nbsp;&amp;nbsp;&amp;nbsp;26&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;Messenger Add-In friendly texts 
&amp;nbsp;&amp;nbsp;&amp;nbsp;28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.AddInProperties.FriendlyName = My.Resources.MessengerAddIn_FriendlyName 
&amp;nbsp;&amp;nbsp;&amp;nbsp;29&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.AddInProperties.Description = My.Resources.MessengerAddIn_Description 
&amp;nbsp;&amp;nbsp;&amp;nbsp;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.AddInProperties.PersonalStatusMessage = 
My.Resources.MessengerAddIn_PersonalStatusMessage 
&amp;nbsp;&amp;nbsp;&amp;nbsp;31&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;Messenger text events 
&amp;nbsp;&amp;nbsp;&amp;nbsp;33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddHandler MeClient.IncomingTextMessage, 
AddressOf Me.IncomingTextMessage 
&amp;nbsp;&amp;nbsp;&amp;nbsp;34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;AddHandler MeClient.OutgoingTextMessage, AddressOf Me.OutgoingTextMessage 
&amp;nbsp;&amp;nbsp;&amp;nbsp;35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;AddHandler MeClient.ShowOptionsDialog, AddressOf Me.ShowOptionsDialog 
&amp;nbsp;&amp;nbsp;&amp;nbsp;36&amp;nbsp;End Sub 

For handling incoming text messages, I have written and registered my own event handler. The event is raised regardless who sent the text message, so we need a way to track users: have we talked with a user before, what kind of query has the user previously
 made etc.; this is achieved using a dictionary having the user&#39;s unique id as key, and an instance of the
Conversation class as value. On line 58 (in C#) or 52 (in VB) you can see how easy it is to detect the user&#39;s status - nothing complicated. Take care at: Windows Live Messenger Add-Ins ca only send a (one) text message as a reply to a (one)
 incoming text message, that&#39;s why I always use a return statement after I send a message (an exception is raised when you try to send multiple messages). I don&#39;t like this issue, you don&#39;t like it, but it keeps me and you secure from malicious add-ins. 
Visual C# 

&amp;nbsp;&amp;nbsp;&amp;nbsp;47&amp;nbsp;private void IncomingTextMessage(object sender,
IncomingTextMessageEventArgs e) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;48&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check if the text message comes from a new user; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // with whom we have not talked before. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!People.ContainsKey(e.UserFrom.UniqueId)) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;52&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;53&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; People.Add(e.UserFrom.UniqueId, new 
Conversation()); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string message = String.Format(CultureInfo.CurrentCulture, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Resources.OTextMessage_Welcome, e.UserFrom.FriendlyName); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;56&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;57&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Verify the status of the user. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.UserFrom.Status != UserStatus.Busy) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;59&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; message &amp;#43;= Resources.OTextMessage_EndWelcome; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;60&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;61&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(message, e.UserFrom); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;62&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;63&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;64&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Pull the previous conversation with the user. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Conversation person = null; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;67&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; People.TryGetValue(e.UserFrom.UniqueId, out person); 

Visual Basic 

&amp;nbsp;&amp;nbsp;&amp;nbsp;43&amp;nbsp;Private Sub IncomingTextMessage(ByVal sender
As Object, ByVal e As IncomingTextMessageEventArgs) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Check if the text message comes from a new user; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; with whom we have not talked before. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not People.ContainsKey(e.UserFrom.UniqueId)
Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp;47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; People.Add(e.UserFrom.UniqueId, New Conversation) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim message As String =
String.Format(CultureInfo.CurrentCulture, _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; My.Resources.OTextMessage_Welcome, e.UserFrom.FriendlyName) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Verify the status of the user. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;52&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; If (e.UserFrom.Status &amp;lt;&amp;gt; UserStatus.Busy)
Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp;53&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; message &amp;#43;= My.Resources.OTextMessage_EndWelcome 
&amp;nbsp;&amp;nbsp;&amp;nbsp;54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&amp;nbsp;&amp;nbsp;&amp;nbsp;55&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(message, e.UserFrom) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;57&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;&amp;nbsp;58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&amp;nbsp;&amp;nbsp;&amp;nbsp;59&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Pull the previous conversation with the user. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;61&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim person As Conversation = 
Nothing 
&amp;nbsp;&amp;nbsp;&amp;nbsp;62&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; People.TryGetValue(e.UserFrom.UniqueId, person) 

What happens when a friend of yours sends you a show events text message and the add-in intercepts it? When a text message validates the condition from line
78-79 (in C#) or 72-73 (in VB), SharePointWrapper.GetEvents (we&#39;ll talk about this later on) is called and used to complete the request; plus, a friendly text message that reflects the previous call is built and sent back. You must always
 send the reply to the user from which the request came from; otherwise, an exception will be thrown. 
Visual C# 

&amp;nbsp;&amp;nbsp;&amp;nbsp;78&amp;nbsp;if (e.TextMessage.StartsWith(Resources.ITextMessage_AllEvents, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; true, CultureInfo.CurrentCulture)) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;82&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;83&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; person.Events = SharePointWrapper.GetEvents( 
&amp;nbsp;&amp;nbsp;&amp;nbsp;84&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; new Uri(Resources.SharePoint_ServerName),
SharePointWrapper.QuerySpan.All); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;85&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;86&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(ReplyGetEvents(person.Events), e.UserFrom); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;87&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;88&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;89&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;91&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(Resources.OTextMessage_Exception, e.UserFrom); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;92&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;93&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;94&amp;nbsp;} 

Visual Basic 

&amp;nbsp;&amp;nbsp;&amp;nbsp;72&amp;nbsp;If e.TextMessage.StartsWith(My.Resources.ITextMessage_AllEvents, _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;73&amp;nbsp;&amp;nbsp;&amp;nbsp; True, CultureInfo.CurrentCulture) Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp;74&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; person.Events = SharePointWrapper.GetEvents( _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;76&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; New Uri(My.Resources.SharePoint_ServerName), SharePointWrapper.QuerySpan.All) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;77&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(ReplyGetEvents(person.Events), e.UserFrom) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As WebException 
&amp;nbsp;&amp;nbsp;&amp;nbsp;81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(My.Resources.OTextMessage_Exception, e.UserFrom) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;82&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;&amp;nbsp;83&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;84&amp;nbsp;End If 

The code that is executed when a user requests help, show events that occur in a week, month or year time is either similar with the previous code, or too simple and I&#39;m not going to display it here. Instead, I&#39;ll show you what happens when a user requests
 to register for an event. A text message that would trigger the code looks like 
register for event 2; all I did was get the id from the incoming message and processed the request; the rest you&#39;ll understand as it looks almost the same. When a user wants to perform an action on an invalid event, the add-in notifies him or her of the
 mistake. 
Visual C# 

&amp;nbsp;&amp;nbsp;184&amp;nbsp;if (e.TextMessage.StartsWith(Resources.ITextMessage_RegisterForEvent, 
&amp;nbsp;&amp;nbsp;185&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; true, CultureInfo.CurrentCulture)) 
&amp;nbsp;&amp;nbsp;186&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;187&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&amp;nbsp;&amp;nbsp;188&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;189&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int id = Convert.ToInt32(e.TextMessage.ToLower().Replace( 
&amp;nbsp;&amp;nbsp;190&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Resources.ITextMessage_RegisterForEvent,
&amp;quot;&amp;quot;).Trim(), CultureInfo.CurrentCulture); 
&amp;nbsp;&amp;nbsp;191&amp;nbsp; 
&amp;nbsp;&amp;nbsp;192&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(ReplyRegisterForEvent( 
&amp;nbsp;&amp;nbsp;193&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; person.Events.Data.GetListItem(id), e.UserFrom.Email), e.UserFrom); 
&amp;nbsp;&amp;nbsp;194&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;195&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;196&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (ArgumentNullException) 
&amp;nbsp;&amp;nbsp;197&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;198&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(Resources.OTextMessage_InvalidEvent, e.UserFrom); 
&amp;nbsp;&amp;nbsp;199&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;201&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException) 
&amp;nbsp;&amp;nbsp;202&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;203&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(Resources.OTextMessage_Exception, e.UserFrom); 
&amp;nbsp;&amp;nbsp;204&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;205&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;206&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception) 
&amp;nbsp;&amp;nbsp;207&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;208&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(Resources.OTextMessage_Exception, e.UserFrom); 
&amp;nbsp;&amp;nbsp;209&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return; 
&amp;nbsp;&amp;nbsp;210&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;211&amp;nbsp;} 

Visual Basic 

&amp;nbsp;&amp;nbsp;153&amp;nbsp;If e.TextMessage.StartsWith(My.Resources.ITextMessage_RegisterForEvent, _ 
&amp;nbsp;&amp;nbsp;154&amp;nbsp;&amp;nbsp; True, CultureInfo.CurrentCulture) Then 
&amp;nbsp;&amp;nbsp;155&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&amp;nbsp;&amp;nbsp;156&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim id As Integer = Convert.ToInt32(e.TextMessage.ToLower().Replace( _ 
&amp;nbsp;&amp;nbsp;157&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; My.Resources.ITextMessage_RegisterForEvent,
&amp;quot;&amp;quot;).Trim, CultureInfo.CurrentCulture) 
&amp;nbsp;&amp;nbsp;158&amp;nbsp; 
&amp;nbsp;&amp;nbsp;159&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(ReplyRegisterForEvent( _ 
&amp;nbsp;&amp;nbsp;160&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; person.Events.Data.GetListItem(id), e.UserFrom.Email), e.UserFrom) 
&amp;nbsp;&amp;nbsp;161&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;162&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As ArgumentNullException 
&amp;nbsp;&amp;nbsp;163&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(My.Resources.OTextMessage_InvalidEvent, e.UserFrom) 
&amp;nbsp;&amp;nbsp;164&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;165&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As WebException 
&amp;nbsp;&amp;nbsp;166&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(My.Resources.OTextMessage_Exception, e.UserFrom) 
&amp;nbsp;&amp;nbsp;167&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;168&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception 
&amp;nbsp;&amp;nbsp;169&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MeClient.SendTextMessage(My.Resources.OTextMessage_Exception, e.UserFrom) 
&amp;nbsp;&amp;nbsp;170&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return 
&amp;nbsp;&amp;nbsp;171&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&amp;nbsp;&amp;nbsp;172&amp;nbsp;End If 

Requests to unregister for events and show details for an event are similar and there is no reason to talk about them. Each task (request) uses its own method to create its reply - that&#39;s were many conditions are checked and a proper response is built. Be
 sure to download the sample, which is available in both languages and discover the hidden aspects for yourself. 
Looking at the Windows SharePoint Services Wrapper Code 
Most Windows SharePoint Services web services use as arguments 
Collaborative Application Markup Language (CAML), so they&#39;re quite flexible. In case you want to do more with SharePoint than I have done here, you&#39;ll have to learn CAML. It&#39;s important to notice that the authentication to the web service, located on line
46 (in C#) or 43 (in VB), is made through the GetSharePointCredentials method; don&#39;t forget to supply your credentials as described within the body of the method. 
Depending on the time span, the appropriate CAML query is built - it checks for a greater date than now and a less date than the one specified in the query span.
Right now I can think of three methods to process the response from the web services: navigate your way using xpaths, work with datasets or... deserialize the response into objects. Although you have to write more code, deserialization brings a huge benefit
 - it&#39;s easier to work with later on; three classes were used to achieve that: 
SharePointListRoot, SharePointListData and SharePointListItem. 
Visual C# 

&amp;nbsp;&amp;nbsp;&amp;nbsp;37&amp;nbsp;public static SharePointListRoot GetEvents(Uri websiteUri,
QuerySpan span) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;38&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (websiteUri == null) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentNullException(&amp;quot;websiteUri&amp;quot;); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;42&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;43&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Work with the Lists web service 
&amp;nbsp;&amp;nbsp;&amp;nbsp;44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Lists wsLists = new 
Lists(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = websiteUri.ToString() &amp;#43; &amp;quot;/_vti_bin/Lists.asmx&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;47&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument xDocument = new
XmlDocument(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xQuery = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Query&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xViewFields = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;ViewFields&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xQueryOptions = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;QueryOptions&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;52&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string viewName = &amp;quot;&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;53&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string rowLimit = &amp;quot;0&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;54&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // CAML (Collaborative Application Markup Language) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; switch (span) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;57&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; case QuerySpan.All: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;59&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = 
&amp;nbsp;&amp;nbsp;&amp;nbsp;60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;61&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;62&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;63&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Where&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; case QuerySpan.InAYear: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = 
&amp;nbsp;&amp;nbsp;&amp;nbsp;67&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;69&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;70&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddYears(1).ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;73&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;74&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; case QuerySpan.InAMonth: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = 
&amp;nbsp;&amp;nbsp;&amp;nbsp;76&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;77&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddMonths(1).ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;82&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;83&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; case QuerySpan.InAWeek: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;84&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = 
&amp;nbsp;&amp;nbsp;&amp;nbsp;85&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;86&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;87&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;88&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;89&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddDays(7).ToString(&amp;quot;s&amp;quot;,
CultureInfo.InvariantCulture) &amp;#43; &amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;91&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;92&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;93&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;94&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xResult = wsLists.GetListItems(Resources.SharePoint_EventsListName, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; viewName, xQuery, xViewFields, rowLimit, xQueryOptions); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;96&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;97&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an SharePointListRoot object from the web response. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;98&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlTextReader xReader = new
XmlTextReader(xResult.OuterXml, XmlNodeType.Element, 
null); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;99&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlSerializer xSerializer = new
XmlSerializer(new SharePointListRoot().GetType()); 
&amp;nbsp;&amp;nbsp;100&amp;nbsp; 
&amp;nbsp;&amp;nbsp;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return (SharePointListRoot)xSerializer.Deserialize(xReader); 
&amp;nbsp;&amp;nbsp;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException) 
&amp;nbsp;&amp;nbsp;104&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;105&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw; 
&amp;nbsp;&amp;nbsp;106&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;107&amp;nbsp;} 

Visual Basic 

&amp;nbsp;&amp;nbsp;&amp;nbsp;35&amp;nbsp;Public Shared Function GetEvents(ByVal websiteUri
As Uri, ByVal span As QuerySpan) As SharePointListRoot 
&amp;nbsp;&amp;nbsp;&amp;nbsp;36&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (websiteUri Is Nothing)
Then 
&amp;nbsp;&amp;nbsp;&amp;nbsp;37&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw New ArgumentNullException(&amp;quot;websiteUri&amp;quot;) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&amp;nbsp;&amp;nbsp;&amp;nbsp;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Work with the Lists web service 
&amp;nbsp;&amp;nbsp;&amp;nbsp;41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim wsLists As Lists = 
New Lists() 
&amp;nbsp;&amp;nbsp;&amp;nbsp;42&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = websiteUri.ToString() &amp;amp; &amp;quot;/_vti_bin/Lists.asmx&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;43&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials() 
&amp;nbsp;&amp;nbsp;&amp;nbsp;44&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xDocument As XmlDocument =
New XmlDocument() 
&amp;nbsp;&amp;nbsp;&amp;nbsp;46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xQuery As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Query&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xViewFields As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;ViewFields&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xQueryOptions As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;QueryOptions&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim viewName As String =
&amp;quot;&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim rowLimit As String =
&amp;quot;0&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;51&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;52&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; CAML (Collaborative Application Markup Language) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;53&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case (span) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;54&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Case QuerySpan.All 
&amp;nbsp;&amp;nbsp;&amp;nbsp;55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;56&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;57&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;59&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Where&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Case QuerySpan.InAYear 
&amp;nbsp;&amp;nbsp;&amp;nbsp;61&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;62&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;63&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddYears(1).ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;67&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Case QuerySpan.InAMonth 
&amp;nbsp;&amp;nbsp;&amp;nbsp;69&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;70&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;73&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;74&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddMonths(1).ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;76&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Case QuerySpan.InAWeek 
&amp;nbsp;&amp;nbsp;&amp;nbsp;77&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Gt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Gt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Lt&amp;gt;&amp;lt;FieldRef Name=&#39;EventDate&#39;/&amp;gt;&amp;lt;Value Type=&#39;DateTime&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;82&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime.UtcNow.AddDays(7).ToString(&amp;quot;s&amp;quot;, CultureInfo.InvariantCulture) &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Lt&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;83&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;84&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End Select 
&amp;nbsp;&amp;nbsp;&amp;nbsp;85&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;86&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xResult As XmlNode = wsLists.GetListItems(My.Resources.SharePoint_EventsListName, _ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;87&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; viewName, xQuery, xViewFields, rowLimit, xQueryOptions) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;88&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;89&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Create an SharePointListRoot object from the web response. 
&amp;nbsp;&amp;nbsp;&amp;nbsp;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xReader As XmlTextReader =
New XmlTextReader(xResult.OuterXml, XmlNodeType.Element, Nothing) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;91&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xSerializer As XmlSerializer =
New XmlSerializer(New SharePointListRoot().GetType()) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;92&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;93&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return CType(xSerializer.Deserialize(xReader), SharePointListRoot) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;94&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As WebException 
&amp;nbsp;&amp;nbsp;&amp;nbsp;95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw 
&amp;nbsp;&amp;nbsp;&amp;nbsp;96&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&amp;nbsp;&amp;nbsp;&amp;nbsp;97&amp;nbsp;End Function 

When you want to add a new attendee, you basically need to add a new item to the Attendees list. A trick to notice: every site has its own web services, so you&#39;ll need to change the URL of the web service to target the web service of the workspace site that
 contains the Attendees list you want to modify; otherwise, a null reference exception will be raised. For example, a Team Web Site is not a Meeting Workspace and does not have a meetings web service. Always take care at this issue when you work with SharePoint
 web services. 
Visual C# 

&amp;nbsp;&amp;nbsp;115&amp;nbsp;public static bool AddAttendee(Uri workspaceUri,
string email) 
&amp;nbsp;&amp;nbsp;116&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;117&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (workspaceUri == null) 
&amp;nbsp;&amp;nbsp;118&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentNullException(&amp;quot;workspaceUri&amp;quot;); 
&amp;nbsp;&amp;nbsp;119&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&amp;nbsp;&amp;nbsp;120&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;121&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Work with the Lists web service 
&amp;nbsp;&amp;nbsp;122&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Lists wsLists = new 
Lists(); 
&amp;nbsp;&amp;nbsp;123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;#43;
&amp;quot;/_vti_bin/Lists.asmx&amp;quot;; 
&amp;nbsp;&amp;nbsp;124&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials(); 
&amp;nbsp;&amp;nbsp;125&amp;nbsp; 
&amp;nbsp;&amp;nbsp;126&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument xDocument = new
XmlDocument(); 
&amp;nbsp;&amp;nbsp;127&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xUpdates = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Batch&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;128&amp;nbsp; 
&amp;nbsp;&amp;nbsp;129&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // CAML (Collaborative Application Markup Language) 
&amp;nbsp;&amp;nbsp;130&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xUpdates.InnerXml = 
&amp;nbsp;&amp;nbsp;131&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Method ID=&#39;1&#39; Cmd=&#39;New&#39;&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;132&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Title&#39;&amp;gt;&amp;quot; &amp;#43; email &amp;#43; 
&amp;quot;&amp;lt;/Field&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;133&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Status&#39;&amp;gt;Accepted&amp;lt;/Field&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;134&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Attendance&#39;&amp;gt;Optional&amp;lt;/Field&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;135&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Method&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;136&amp;nbsp; 
&amp;nbsp;&amp;nbsp;137&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xResult = wsLists.UpdateListItems(Resources.SharePoint_AttendeesListName, 
&amp;nbsp;&amp;nbsp;138&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xUpdates); 
&amp;nbsp;&amp;nbsp;139&amp;nbsp; 
&amp;nbsp;&amp;nbsp;140&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Since we are performing only one action (a new), we get as response only one node; 
&amp;nbsp;&amp;nbsp;141&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // we check to see if there was an error completing the task. 
&amp;nbsp;&amp;nbsp;142&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return (xResult.ChildNodes[0].ChildNodes[0].InnerText ==
&amp;quot;0x00000000&amp;quot;); 
&amp;nbsp;&amp;nbsp;143&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;144&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException) 
&amp;nbsp;&amp;nbsp;145&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;146&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw; 
&amp;nbsp;&amp;nbsp;147&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;148&amp;nbsp;} 

Visual Basic 

&amp;nbsp;&amp;nbsp;105&amp;nbsp;Public Shared Function AddAttendee(ByVal workspaceUri
As Uri, ByVal email As String)
As Boolean 
&amp;nbsp;&amp;nbsp;106&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (workspaceUri Is Nothing)
Then 
&amp;nbsp;&amp;nbsp;107&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw New ArgumentNullException(&amp;quot;workspaceUri&amp;quot;) 
&amp;nbsp;&amp;nbsp;108&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&amp;nbsp;&amp;nbsp;109&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&amp;nbsp;&amp;nbsp;110&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Work with the Lists web service 
&amp;nbsp;&amp;nbsp;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim wsLists As Lists = 
New Lists() 
&amp;nbsp;&amp;nbsp;112&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;amp;
&amp;quot;/_vti_bin/Lists.asmx&amp;quot; 
&amp;nbsp;&amp;nbsp;113&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials() 
&amp;nbsp;&amp;nbsp;114&amp;nbsp; 
&amp;nbsp;&amp;nbsp;115&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xDocument As XmlDocument =
New XmlDocument() 
&amp;nbsp;&amp;nbsp;116&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xUpdates As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Batch&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;117&amp;nbsp; 
&amp;nbsp;&amp;nbsp;118&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; CAML (Collaborative Application Markup Language) 
&amp;nbsp;&amp;nbsp;119&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xUpdates.InnerXml = _ 
&amp;nbsp;&amp;nbsp;120&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Method ID=&#39;1&#39; Cmd=&#39;New&#39;&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;121&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Title&#39;&amp;gt;&amp;quot; &amp;amp; email &amp;amp; 
&amp;quot;&amp;lt;/Field&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;122&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Status&#39;&amp;gt;Accepted&amp;lt;/Field&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Field Name=&#39;Attendance&#39;&amp;gt;Optional&amp;lt;/Field&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;124&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Method&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;125&amp;nbsp; 
&amp;nbsp;&amp;nbsp;126&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xResult As XmlNode = wsLists.UpdateListItems(My.Resources.SharePoint_AttendeesListName, _ 
&amp;nbsp;&amp;nbsp;127&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xUpdates) 
&amp;nbsp;&amp;nbsp;128&amp;nbsp; 
&amp;nbsp;&amp;nbsp;129&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Since we are performing only one action (a new), we get as response only one node; 
&amp;nbsp;&amp;nbsp;130&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; we check to see if there was an error completing the task. 
&amp;nbsp;&amp;nbsp;131&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Return (xResult.ChildNodes(0).ChildNodes(0).InnerText =
&amp;quot;0x00000000&amp;quot;) 
&amp;nbsp;&amp;nbsp;132&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As WebException 
&amp;nbsp;&amp;nbsp;133&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw 
&amp;nbsp;&amp;nbsp;134&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&amp;nbsp;&amp;nbsp;135&amp;nbsp;End Function 

When a user wants to re-register for an event, we won&#39;t add it again to the Attendees list, because we would have duplicate items; instead, we are going to use the Meetings web service to set its response back from Declined to Accepted, or from Accepted
 to Declined, in the unregister case. Again, the URLs targeting the web services are set as they should be. This is one of the places you need to modify in order to make it work with non-recurrent events; check the comments within the code for more details. 
Visual C# 

&amp;nbsp;&amp;nbsp;198&amp;nbsp;public static void SetAttendee(Uri workspaceUri,
string email, AttendeeResponse response) 
&amp;nbsp;&amp;nbsp;199&amp;nbsp;{ 
&amp;nbsp;&amp;nbsp;200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (workspaceUri == null) 
&amp;nbsp;&amp;nbsp;201&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentNullException(&amp;quot;workspaceUri&amp;quot;); 
&amp;nbsp;&amp;nbsp;202&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&amp;nbsp;&amp;nbsp;203&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;204&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Work with the Lists web service 
&amp;nbsp;&amp;nbsp;205&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Lists wsLists = new 
Lists(); 
&amp;nbsp;&amp;nbsp;206&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;#43;
&amp;quot;/_vti_bin/Lists.asmx&amp;quot;; 
&amp;nbsp;&amp;nbsp;207&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials(); 
&amp;nbsp;&amp;nbsp;208&amp;nbsp; 
&amp;nbsp;&amp;nbsp;209&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Also work with the Meetings web service 
&amp;nbsp;&amp;nbsp;210&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Meetings wsMeetings = new
Meetings(); 
&amp;nbsp;&amp;nbsp;211&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;#43;
&amp;quot;/_vti_bin/Meetings.asmx&amp;quot;; 
&amp;nbsp;&amp;nbsp;212&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.Credentials = GetSharePointCredentials(); 
&amp;nbsp;&amp;nbsp;213&amp;nbsp; 
&amp;nbsp;&amp;nbsp;214&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument xDocument = new
XmlDocument(); 
&amp;nbsp;&amp;nbsp;215&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xQuery = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Query&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;216&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xViewFields = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;ViewFields&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;217&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xQueryOptions = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;QueryOptions&amp;quot;, &amp;quot;&amp;quot;); 
&amp;nbsp;&amp;nbsp;218&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string viewName = &amp;quot;&amp;quot;; 
&amp;nbsp;&amp;nbsp;219&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string rowLimit = &amp;quot;0&amp;quot;; 
&amp;nbsp;&amp;nbsp;220&amp;nbsp; 
&amp;nbsp;&amp;nbsp;221&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // For non-recurring events, SharePoint sets the default id to 1; 
&amp;nbsp;&amp;nbsp;222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // so it&#39;s safe to query only for the meeting with the instance id equal to 1. 
&amp;nbsp;&amp;nbsp;223&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = 
&amp;nbsp;&amp;nbsp;224&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;225&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=&#39;ID&#39;/&amp;gt;&amp;lt;Value Type=&#39;Counter&#39;&amp;gt;&amp;quot; &amp;#43; 1 &amp;#43;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;quot; &amp;#43; 
&amp;nbsp;&amp;nbsp;226&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Where&amp;gt;&amp;quot;; 
&amp;nbsp;&amp;nbsp;227&amp;nbsp; 
&amp;nbsp;&amp;nbsp;228&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNode xResult = wsLists.GetListItems(Resources.SharePoint_MeetingSeriesListName, 
&amp;nbsp;&amp;nbsp;229&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; viewName, xQuery, xViewFields, rowLimit, xQueryOptions); 
&amp;nbsp;&amp;nbsp;230&amp;nbsp; 
&amp;nbsp;&amp;nbsp;231&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // We know the instance id, but we need the unique id of the meeting. 
&amp;nbsp;&amp;nbsp;232&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string uid = xResult.ChildNodes[1].ChildNodes[1].Attributes[&amp;quot;ows_EventUID&amp;quot;].InnerText; 
&amp;nbsp;&amp;nbsp;233&amp;nbsp; 
&amp;nbsp;&amp;nbsp;234&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.SetAttendeeResponse(email, 0, uid, 1, 
DateTime.UtcNow, DateTime.UtcNow, response); 
&amp;nbsp;&amp;nbsp;235&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;236&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (WebException) 
&amp;nbsp;&amp;nbsp;237&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;238&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; throw; 
&amp;nbsp;&amp;nbsp;239&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;240&amp;nbsp;} 

Visual Basic 

&amp;nbsp;&amp;nbsp;182&amp;nbsp;Public Shared Sub SetAttendee(ByVal workspaceUri
As Uri, ByVal email As String,
ByVal response As AttendeeResponse) 
&amp;nbsp;&amp;nbsp;183&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (workspaceUri Is Nothing)
Then 
&amp;nbsp;&amp;nbsp;184&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw New ArgumentNullException(&amp;quot;workspaceUri&amp;quot;) 
&amp;nbsp;&amp;nbsp;185&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&amp;nbsp;&amp;nbsp;186&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&amp;nbsp;&amp;nbsp;187&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Work with the Lists web service 
&amp;nbsp;&amp;nbsp;188&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim wsLists As Lists = 
New Lists() 
&amp;nbsp;&amp;nbsp;189&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;#43;
&amp;quot;/_vti_bin/Lists.asmx&amp;quot; 
&amp;nbsp;&amp;nbsp;190&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsLists.Credentials = GetSharePointCredentials() 
&amp;nbsp;&amp;nbsp;191&amp;nbsp; 
&amp;nbsp;&amp;nbsp;192&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; Also work with the Meetings web service 
&amp;nbsp;&amp;nbsp;193&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim wsMeetings As Meetings =
New Meetings() 
&amp;nbsp;&amp;nbsp;194&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.Url = workspaceUri.GetLeftPart(UriPartial.Path) &amp;#43;
&amp;quot;/_vti_bin/Meetings.asmx&amp;quot; 
&amp;nbsp;&amp;nbsp;195&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.Credentials = GetSharePointCredentials() 
&amp;nbsp;&amp;nbsp;196&amp;nbsp; 
&amp;nbsp;&amp;nbsp;197&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xDocument As XmlDocument =
New XmlDocument() 
&amp;nbsp;&amp;nbsp;198&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xQuery As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;Query&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;199&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xViewFields As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;ViewFields&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xQueryOptions As XmlNode = xDocument.CreateNode(XmlNodeType.Element,
&amp;quot;QueryOptions&amp;quot;, &amp;quot;&amp;quot;) 
&amp;nbsp;&amp;nbsp;201&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim viewName As String =
&amp;quot;&amp;quot; 
&amp;nbsp;&amp;nbsp;202&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim rowLimit As String =
&amp;quot;0&amp;quot; 
&amp;nbsp;&amp;nbsp;203&amp;nbsp; 
&amp;nbsp;&amp;nbsp;204&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; For non-recurring events, SharePoint sets the default id to 1; 
&amp;nbsp;&amp;nbsp;205&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; so it&#39;s safe to query only for the meeting with the instance id equal to 1. 
&amp;nbsp;&amp;nbsp;206&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; xQuery.InnerXml = _ 
&amp;nbsp;&amp;nbsp;207&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Where&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;208&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=&#39;ID&#39;/&amp;gt;&amp;lt;Value Type=&#39;Counter&#39;&amp;gt;&amp;quot; &amp;amp; 1 &amp;amp;
&amp;quot;&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;quot; &amp;amp; _ 
&amp;nbsp;&amp;nbsp;209&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;&amp;lt;/Where&amp;gt;&amp;quot; 
&amp;nbsp;&amp;nbsp;210&amp;nbsp; 
&amp;nbsp;&amp;nbsp;211&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim xResult As XmlNode = wsLists.GetListItems(My.Resources.SharePoint_MeetingSeriesListName, _ 
&amp;nbsp;&amp;nbsp;212&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; viewName, xQuery, xViewFields, rowLimit, xQueryOptions) 
&amp;nbsp;&amp;nbsp;213&amp;nbsp; 
&amp;nbsp;&amp;nbsp;214&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &#39; We know the instance id, but we need the unique id of the meeting. 
&amp;nbsp;&amp;nbsp;215&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim uid As String = xResult.ChildNodes(1).ChildNodes(1).Attributes(&amp;quot;ows_EventUID&amp;quot;).InnerText 
&amp;nbsp;&amp;nbsp;216&amp;nbsp; 
&amp;nbsp;&amp;nbsp;217&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsMeetings.SetAttendeeResponse(email, 0, uid, 1, DateTime.UtcNow, DateTime.UtcNow, response) 
&amp;nbsp;&amp;nbsp;218&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As WebException 
&amp;nbsp;&amp;nbsp;219&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Throw 
&amp;nbsp;&amp;nbsp;220&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&amp;nbsp;&amp;nbsp;221&amp;nbsp;End Sub 

This concludes our overview of the code. Not every line of code is displayed here, but the number preceding each line of code is the actual line number from the sample code files; so, if you have any questions about the code you&#39;ll be able to find it in
 a snap. 
It Works on Windows Live Messenger Network 
Although you can talk with your Yahoo! friends using text messages, Windows Live Messenger Add-Ins do not work with Yahoo! contacts; in other words, the add-in won&#39;t receive the text messages from them, although you see them, so it does not have how to send
 text messages back. You&#39;ll have to find another suitable alternative for them to register for your events.
The usual way of testing a messenger add-in is to ask a friend of yours to send you text messages. Of course, you can have multiple Windows Live Ids and use
Virtual PC to install and run more messengers; but hey, I did not want to do that. So, at one moment I had an interesting idea: why not make
Encarta Instant Answers (which is a BOT) make it send me some text messages that matched my patterns (e.g. show events). In case you say to Encarta Instant Answers
show events, it will respond with something like: Why must I show events? (the response you get may differ). It should have worked, but unfortunately it&#39;s the same as in the Yahoo! case.
The good news is that it works with your friends that are connected to the Windows Live Messenger Network using Pocket MSN. I was curious and tried MSN Messenger on a device running Windows Mobile 5.1 Pocket PC Phone Edition and it worked fine; I was able to
 interact with the add-in. Do not get me wrong, add-ins can be loaded only on a Windows Live Messenger, and not on a Pocket MSN.
And a dummy remark: people who use Windows Live Messenger have no problems using Windows Live Messenger Add-Ins. 
Demo 
In the end, I just want to show you how it works, because so far we have only talked around the subject without seeing it in action. Return to your
Personal Settings &amp;gt; Add-ins, as illustrated in [Fig. 1] and click Add to Messenger; navigate to your sample installation folder and select the
EventsAgent.MessengerAddIn.dll assembly. After completing this, the combo should have the
Events Agent value; optionally, you may want to check the Automatically turn on this add-in when my status is anything other than Online or Appear Offline box. By clicking
Turn on &amp;quot;Events Agent&amp;quot;, like in [Fig. 6] you are activating your add-in and allowing it to interact with your friends, and this is what we expect it to do! 
&amp;nbsp;

[Figure 5] 
Before I give it a spin, please check my sample events that will be used to demonstrate the project. In [Fig. 6] you can see that I am using three events that occur at different time intervals, and all of them are using meeting workspaces to allow people
 to enroll in events as attendees. 


[Figure 6] 
It&#39;s spinning... in [Fig. 7] you can watch my conversation with one of my friends. A golden bar tells us that we have almost reached our goal; you&#39;ll be able to recognize text messages sent by the add-in when a message begins with a
Paul-Valentin Borza&#39;s add-in &amp;quot;Events Agent&amp;quot; says: text. 


[Figure 7] 
Oh, you&#39;re right it&#39;s not my conversation - I haven&#39;t written a single word, or character: our project, the Windows Live Messenger Add-In Events Agent has done all the work for me. And that&#39;s great because that means my work here is done! Don&#39;t forget to
 look at the result: there are two attendees now. 


[Figure 8] 
Conclusion 
I&#39;m happy that you learned how to use and combine two powerful technologies: Windows Live Messenger Add-Ins and Windows SharePoint Services. You have built your own events agent that will serve you every time you start your favorite messenger. You&#39;ll now
 be able to show it to your friends while talking to them, from the same windows you have always did before! I&#39;m sure they&#39;ll be quite surprised... mine were. You can try my events agent on my Windows Live Messenger Id
windowslive@borza.ro; you&#39;ll even be able to talk with me in case you need any assistance.

Being at my second Coding4Fun article, I feel great when I can help people achieve a greater potential that has always been within their reach; and all of these happening while simply coding for fun. Thanks to the Microsoft Academic Program Team Romania for
 support. 
Improvements 
I encourage you to extend my work by: 

Making it say &amp;quot;Happy New Year!&amp;quot; in addition to the welcome message. Making it work with recurrent events. Using 
Credentials Management with .NET Framework 2.0 together with the project. Using the 
Messenger Activity SDK to further extend the agent, like Encarta Instant Answers does.
Making it work with Windows SharePoint Services 3.0; please check the 
Windows SharePoint Services Version Comparison before.
Bio 
Paul-Valentin Borza is in its second year of study at the Babes-Bolyai University of Cluj-Napoca, Faculty of Mathematics and Computer Science. Since 2005, he is involved in the Microsoft Student Partners - Microsoft Academic Program Romania. He can be reached
 through his web site at www.borza.ro. 
</description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 22 May 2013 05:38:42 GMT</pubDate>
	<lastBuildDate>Wed, 22 May 2013 05:38:42 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Building your own Windows Live Messenger Events Agent</title>
		<description>
			<![CDATA[ <p>My second (2nd!) Coding4Fun article just got published on MSDN Coding4Fun! I want to thank Todi Pruteanu...</p><p>posted by the spark and the pioneer</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633089268000000000</link>
		<pubDate>Thu, 08 Mar 2007 05:00:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633089268000000000</guid>
		<dc:creator>the spark and the pioneer</dc:creator>
	</item>
	<item>
		<title>Re: Building your own Windows Live Messenger Events Agent</title>
		<description>
			<![CDATA[ <p>Could u tell me how to change the nickname?</p><p>posted by Chi Wang</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633162672000000000</link>
		<pubDate>Fri, 01 Jun 2007 04:00:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633162672000000000</guid>
		<dc:creator>Chi Wang</dc:creator>
	</item>
	<item>
		<title>Re: Building your own Windows Live Messenger Events Agent</title>
		<description>
			<![CDATA[ <p>i couldn't reach the : HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger\AddInFeatureEnabled by the way i m using WLM 8.5 any idea????</p><p>posted by yassir</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633236976000000000</link>
		<pubDate>Sun, 26 Aug 2007 04:00:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633236976000000000</guid>
		<dc:creator>yassir</dc:creator>
	</item>
	<item>
		<title>Re: Building your own Windows Live Messenger Events Agent</title>
		<description>
			<![CDATA[ <p>And why don't some channels show up, like mine!? , </p><p>posted by Bill</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633599856000000000</link>
		<pubDate>Sun, 19 Oct 2008 04:00:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633599856000000000</guid>
		<dc:creator>Bill</dc:creator>
	</item>
	<item>
		<title>Re: Building your own Windows Live Messenger Events Agent</title>
		<description>
			<![CDATA[ <p>I cant find any MessengerClient.dll file on my PC.</p><p>I am using Windows Live Messenger V14. Are these addons still supported?</p><p>posted by no1</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633844368000000000</link>
		<pubDate>Wed, 29 Jul 2009 04:00:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/articles/Building-your-own-Windows-Live-Messenger-Events-Agent#c633844368000000000</guid>
		<dc:creator>no1</dc:creator>
	</item>
</channel>
</rss>