SPAudit.WriteAuditEvent Method (SPWeb, String, SPAuditItemType, SPAuditEventType, String, String, String)

Writes an unrestricted volume of data to the audit history in the SharePoint database.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Shared Function WriteAuditEvent ( _
    web As SPWeb, _
    serverRelativeUrl As String, _
    itemType As SPAuditItemType, _
    eventId As SPAuditEventType, _
    eventName As String, _
    eventSource As String, _
    xmlData As String _
) As Boolean
'Usage
Dim web As SPWeb
Dim serverRelativeUrl As String
Dim itemType As SPAuditItemType
Dim eventId As SPAuditEventType
Dim eventName As String
Dim eventSource As String
Dim xmlData As String
Dim returnValue As Boolean

returnValue = SPAudit.WriteAuditEvent(web, _
    serverRelativeUrl, itemType, eventId, _
    eventName, eventSource, xmlData)
public static bool WriteAuditEvent(
    SPWeb web,
    string serverRelativeUrl,
    SPAuditItemType itemType,
    SPAuditEventType eventId,
    string eventName,
    string eventSource,
    string xmlData
)

Parameters

  • serverRelativeUrl
    Type: System.String

    The path of the item associated with the event.

  • eventName
    Type: System.String

    The name of the event (used if eventId is a custom event).

  • eventSource
    Type: System.String

    The source of the event. This parameter is optional.

Return Value

Type: System.Boolean
true if the event was recorded successfully; otherwise, false.

See Also

Reference

SPAudit Class

SPAudit Members

WriteAuditEvent Overload

Microsoft.SharePoint Namespace