GetDesktopAlertNotifications


Description

This method retrieves a list of workflow notifications.

Parameters

Parameter

Type

Description

organizationKey

OrganizationKey

Specifies the unique identifier of the company for which notifications are being examined.

createdSinceTime

dateTime

Specifies the beginning of the time period for which notifications are being retrieved.

notificationType

NotificationType

Specifies the type of notification to retrieve.


Return Value:

Value

Type

Description

GetNotificationsAsOfDateTimeResult

ArrayOfNotification

A list of notifications


Examples

The following C# example retrieves the list of all workflow notifications that have occurred in the last hour for the sample company. The list of notifications is displayed in a dialog.

Be sure to use the URL and port for your workflow server.


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Dynamics.Workflow.Proxy;

namespace WorkflowWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Notification[] notifications;
			DateTime notificationsSince;
			TimeSpan ts;

			// Create an instance of the web service
			DynamicsWorkflow wsWorkflow = new DynamicsWorkflow();

			// Specify the URL used to access the Workflow web service
			wsWorkflow.Url = "http://WorkflowServer:10072/_vti_bin/WorkflowService.asmx";

			// Be sure that default credentials are being used
			wsWorkflow.UseDefaultCredentials = true;

			// Create the company key for the sample company
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set the timepan to 1 hour
			ts = new TimeSpan(1,0,0);
			notificationsSince = DateTime.Now;
			notificationsSince = notificationsSince.Subtract(ts);

			// Get the notifications for this company in the last hour
			notifications = wsWorkflow.GetDesktopAlertNotifications(companyKey, notificationsSince,
			NotificationType.All);

			// Display the notifications
			StringBuilder notificationList = new StringBuilder();
			foreach (Notification n in notifications)
			{
				notificationList.AppendLine(n.BusinessObjectType + "  " + n.Description + " -- " +
				n.AssignedTo);
		}
			MessageBox.Show(notificationList.ToString());
	}
}
}


Documentation Feedback