Export (0) Print
Expand All

SPAudit.WriteAuditEvent method (String, String, String)

Writes a record about an event to the SharePoint database.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public bool WriteAuditEvent(
	string eventName,
	string eventSource,
	string xmlData
)

Parameters

eventName
Type: System.String

The kind of event being recorded.

eventSource
Type: System.String

The name of the calling application.

xmlData
Type: System.String

The information about the event.

Return value

Type: System.Boolean
true in all cases.

Use this method to write records of custom events when you have multiple kinds of custom events and need the event record to be more specific than just "custom". Pass the name of one of your custom event types for eventName. Pass the name of your SharePoint solution as eventSource. Optionally, pass up to 4000 characters of additional information about the event as xmlData.

You can use any XML schema you want to format xmlData, or you can use undefined XML. However, when you are including data that is essentially the same as event data that SharePoint Foundation uses in its built-in events, reading and processing your database records is easier if you use the same tags. For example, if your event data refers to an object other than the one on which the event was raised, use the pattern <RelatedItem><Id>GUID_of_other_object</Id><Relationship>some_relationship</Relationship></RelatedItem>, which is similar to what SharePoint Foundation uses for ChildDelete events. See the topic for SPAuditEntry.EventData for more information on the XML tags that SharePoint Foundation uses.

Show:
© 2014 Microsoft