Share via


How to: Access Detailed Request Information Using a Notification Handler

When an event is triggered, Forefront Identity Manager Certificate Management (FIM CM) passes a Notification object to the Notify() methods of each instantiated object that is subscribed to that event (see How to: Register for an Event Using a Notification Handler). Therefore, in the Notify() method of your notification handler class, you will have access to details about the event through the public properties of the Notification class.

Sample: Accessing Request Details

The following sample code shows how the Notify() function could be used to output basic information about an object to the screen.

using Microsoft.Clm.Shared.Requests;
using Microsoft.Clm.Shared.ProfileTemplates;
using Microsoft.Clm.Shared.Notifications;

namespace Contoso.Clm.Test.SampleNotificationSinks
{
    class OnCreateProfile : INotificationSink
    {
       #region INotificationSink Members

        void INotificationSink.Initialize(string data)
        {
            System.Diagnostics.Debug.Write("Initialization Data: " + data);
        }

        void INotificationSink.Notify(Notification notification)
        {
            if (notification.NotificationType != NotificationType.CreateProfile)
                throw new ApplicationException("Invalid notification received");

            System.Diagnostics.Debug.Write("Request Uuid: " + notification.Request.Uuid);
            System.Diagnostics.Debug.Write("Request Type: " + notification.Request.RequestType.ToString());
            System.Diagnostics.Debug.Write(notification.Request.DataCollection[0].Name + ": " + notification.Request.DataCollection[0].Value);
            System.Diagnostics.Debug.Write("Profile Template: " + notification.Request.ProfileTemplateUuid);
            System.Diagnostics.Debug.Write("Success: " + notification.IsSuccess);
            System.Diagnostics.Debug.Write("Actor: " + notification.ActorUserUuid); 
            
        }

        #endregion
    }
       
}

See Also

Concepts

How to: Register for an Event Using a Notification Handler
How to: Log Notification Events

Other Resources

FIM CM Provision API Overview