Take a survey

API Quick Starts (Code Examples) > Rights Management Service API Quick Starts > Quick Start: Searching for events using the web service API

Quick Start: Searching for events using the web service API
The following C# code example searches for the create policy event.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO ; 
 
namespace SearchEvents
{
	
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
				//Create a RightsManagementServiceService object
				RightsManagementServiceService rmClient = new RightsManagementServiceService(); 
				rmClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
 
				//Create an EventSpec object
				EventSpec eventSpec = new EventSpec(); 
 
				//Specify the POLICY_CREATE_EVENT
				eventSpec.eventCode = 3003; 
 
				//Search for the POLICY_CREATE_EVENT
				mapItem[] result = rmClient.searchForEvents(eventSpec);
				  
				//Determine the number of times that this event has occurred
				int numTimes = 0; 
				for (int i = 0; i < result.Length; i++)
				{
					String myKey = (String)(result[i].key);
 
					if (myKey == "count")
					{
						numTimes = (int)(result[i].value);
					}
				}
 
				Console.WriteLine("The POLICY_CREATE_EVENT has occurred "+ numTimes +" times."); 
 
		}
 
		catch (Exception ee)
	{
		Console.WriteLine(ee.Message);  
	}
		}
	}
}
 
 
 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_RightsManagement.15.18.html