SPAudit.WriteAuditEvent method (String, String, Int32, String)

Writes the audit entry with customized user ID.

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

Syntax

'Declaration
Public Function WriteAuditEvent ( _
    eventName As String, _
    eventSource As String, _
    userId As Integer, _
    xmlData As String _
) As Boolean
'Usage
Dim instance As SPAudit
Dim eventName As String
Dim eventSource As String
Dim userId As Integer
Dim xmlData As String
Dim returnValue As Boolean

returnValue = instance.WriteAuditEvent(eventName, _
    eventSource, userId, xmlData)
public bool WriteAuditEvent(
    string eventName,
    string eventSource,
    int userId,
    string xmlData
)

Parameters

  • eventSource
    Type: System.String

    The name of the calling application.

Return value

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

Remarks

Only the System Account will be able to specify the user ID. All other users trying to specify different IDs from their own will be regarded as spoofing and be terminated.

See also

Reference

SPAudit class

SPAudit members

WriteAuditEvent overload

Microsoft.SharePoint namespace