EventGridEvent Class

Definition

Properties of an event published to an Event Grid topic using the EventGrid Schema.

[System.Text.Json.Serialization.JsonConverter(typeof(Azure.Messaging.EventGrid.EventGridEventConverter))]
public class EventGridEvent
[<System.Text.Json.Serialization.JsonConverter(typeof(Azure.Messaging.EventGrid.EventGridEventConverter))>]
type EventGridEvent = class
Public Class EventGridEvent
Inheritance
EventGridEvent
Attributes

Constructors

EventGridEvent(String, String, String, BinaryData)

Initializes a new instance of EventGridEvent.

EventGridEvent(String, String, String, Object, Type)

Initializes a new instance of EventGridEvent.

Properties

Data

Gets or sets the event payload as BinaryData. Using BinaryData, one can deserialize the payload into rich data, or access the raw JSON data using ToString().

DataVersion

Gets or sets the schema version of the data object.

EventTime

Gets or sets the time (in UTC) the event was generated.

EventType

Gets or sets the type of the event that occurred.

Id

Gets or sets a unique identifier for the event.

Subject

Gets or sets a resource path relative to the topic path.

Topic

Gets or sets the resource path of the event source. This must be set when publishing the event to a domain, and must not be set when publishing the event to a topic.

Methods

Parse(BinaryData)

Given a single JSON-encoded event, parses the event envelope and returns an EventGridEvent. If the specified event is not valid JSON, or the event is missing required properties, an exception is thrown.

ParseMany(BinaryData)

Given JSON-encoded events, parses the event envelope and returns an array of EventGridEvents. If the content is not valid JSON, or events are missing required properties, an exception is thrown.

TryGetSystemEventData(Object)

Gets whether or not the event is a System defined event and returns the deserialized system event via out parameter.

Extension Methods

TryCreatePushNotification(EventGridEvent, PushNotification)

Tries to create the PushNotification object from the details in EventGridEvent object. Return value indicates whether the operation succeeded or failed.

Applies to