Prerequisites
This sample requires the following:
- A target server that is running a version of Exchange starting with Exchange Server 2007 Service Pack 1 (SP1), including Exchange Online as part of Office 365.
- The .NET Framework 4.
- The EWS Managed API assembly file, Microsoft.Exchange.WebServices.dll. You can download the assembly from the
Microsoft Download Center.
Note The sample assumes that the assembly is in the default download directory. You will need to verify the path before you run the solution. - A version of Visual Studio starting with Visual Studio 2010. Or
- A text editor to create and edit source code files and a command prompt window to run a .NET Framework command line compiler.
Key components of the sample
This sample contains the following files:
- Ex15_SetStreamingNotifications_CS.sln — The Visual Studio solution file for the Ex15_SetStreamingNotifications_CS project.
- Ex15_SetStreamingNotifications_CS.csproj — The Visual Studio project file for the SubscribeToStreamingNotifications function.
- app.config — Contains configuration data for the Ex15_SetPullNotifications_CS project.
- Ex15_SetStreamingNotifications_CS.cs — Contains the using statements, namespace, class, and functions to create a streaming subscription.
- Ex15_Authentication_CS.csproj — The Visual Studio project file for the dependent authentication code.
- CredentialHelper.cs — Contains the using directives, namespace, class, and functions to prompt for credentials, verify credentials, and store credentials for an application that uses EWS.
- TextFileTraceListener.cs — Contains the using statements, namespace, class, and code to write the XML request and response to a text file.
- Service.cs — Contains the using statements, namespace, class, and functions necessary to acquire an ExchangeService object used in the Ex15_SetStreamingNotifications_CS project.
- CertificateCallback.cs — Contains the using statements, namespace, class, and code to acquire an X509 certificate.
- UserData.cs — Contains the using statements, namespace, class, and functions necessary to acquire user information required by the service object.
Configure the sample
Follow these steps to configure the Exchange 2013: Set streaming notifications for applications programmatically sample.
- Set the startup project to Ex15_SetStreamingNotifications_CS by selecting the project in the Solution Explorer and choosing "Set as StartUp Project" from the Project menu.
- Ensure that the reference path for the Microsoft.Exchange.WebServices.dll points to where the DLL is installed on your local computer.
Build the sample
Press F5 to build and deploy the sample.
Run and test the sample
Press F5 to run the sample.
When you are prompted to press or select Enter, wait to press Enter until you want the program to end. Send an email to the Inbox that you are monitoring and you will see the notifications pop up in the command window. After the timeout of one minute, you can choose whether you want to reestablish the connection.
Related content
Change log
| Date | Description |
|---|---|
| December 10, 2013 | Updated the sample to accept user input after the subscription times out. |
| July 22, 2013 | First release. |