Dela via


Navigating the Notification Sample Application Source Code

Topic Last Modified: 2007-04-16

The following files contain the source code for the Notification Sample Application:

  • WebDavAccessor.cs
  • MainForm.vb
  • Settings.vb

WebDavAccessor.cs is installed in the directory in which the Microsoft Exchange Server 2007 Software Development Kit (SDK) is installed, in the \Samples\Notification\NotificationSampleWebDAV\ folder. MainForm.vb and Settings.vb are installed \Samples\Notification\NotificationSample\ folder in the directory in which the Exchange Server 2007 SDK is installed.

WebDavAccessor is a Microsoft C# class library that is used to subscribe to a resource in an Exchange store and poll the Microsoft Exchange server for event notifications. The Settings Microsoft Visual Basic .NET form is used to display user settings such as User Name, Password, and Domain, and utilizes the WebDavAccessor class to create and remove subscriptions on resources. A timer event also uses the WebDavAccessor class to poll the Microsoft Exchange server periodically for event notifications. If a notification occurs, an event is raised in the MainForm form, which displays an icon to alert the user of the notification. The MainForm form is used to handle the system tray icon, the context menu, and the notification events that are generated by the Settings form.

The functions and subprocedures related to notifications are listed by source file in the following tables.

WebDavAccessor.cs

Function Description

Subscribe(string Uri, WebDavAccessor.SubscriptionNotifyType NotifyType)

Calls the Action function, which subscribes to the resource at the URI for the notification.

Unsubscribe(string Uri, string subscriptionID)

Calls the Action function, which removes the subscription with the subscription ID on the resource at the URI.

Poll(string Uri, string subscriptionID)

Calls the Action function, which polls the Microsoft Exchange server for any events that may have fired on the subscription specified by the subscription ID.

Action(string Uri, string Method, string NotificationType, string SubscriptionID)

Makes the WebDAV method request on the URI.

Settings.vb

Subprocedure/Function Description

PollTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PollTimer.Tick

The event handler for the PollTimer.Tick event. Uses the WebDavAccessor class to poll the Microsoft Exchange server for events.

Subscribe()

Uses the WebDavAccessor class to subscribe to a resource in the Microsoft Exchange server.

Unsubscribe()

Uses the WebDavAccessor class to remove the current subscription on a resource.

SetAuthentication() As Boolean

Sets the credentials in the WebDavAccessor class, which are used to authenticate the user on the Microsoft Exchange server.