SPAudit.WriteAuditEvent 方法 (String, String, String)

有关事件的记录写入 SharePoint 数据库。

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Function WriteAuditEvent ( _
    eventName As String, _
    eventSource As String, _
    xmlData As String _
) As Boolean
用法
Dim instance As SPAudit
Dim eventName As String
Dim eventSource As String
Dim xmlData As String
Dim returnValue As Boolean

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

参数

  • eventName
    类型:System.String

    正在记录的事件类型。

  • eventSource
    类型:System.String

    调用应用程序的名称。

返回值

类型:System.Boolean
在所有情况下的true 。

备注

使用此方法可以编写自定义事件,当您有多个类型的自定义事件,并需要事件记录要比只是"自定义"更具体的记录。通过eventName您的自定义事件类型之一的名称。通过您的 SharePoint 解决方案的名称为eventSource。(可选) 将作为xmlData传递有关该事件的其他信息的最多 4000 个的字符。

您可以使用任何 XML 架构,您想要格式化xmlData,或您可以使用未定义的 XML。但是,都包括在本质上是事件数据相同的数据时, SharePoint Foundation使用在其内置事件中,阅读和处理您的数据库记录是更容易,如果您使用相同的标记。例如,如果事件数据指的是对象而不是在其上引发该事件时,使用模式<RelatedItem><Id>GUID_of_other_object</Id><Relationship>some_relationship</Relationship></RelatedItem>,这是类似于什么SharePoint Foundation使用ChildDelete事件。请参见 XML 的详细信息标记该SharePoint FoundationSPAuditEntry.EventData的主题使用。

另请参阅

引用

SPAudit 类

SPAudit 成员

WriteAuditEvent 重载

Microsoft.SharePoint 命名空间

其他资源

Item-Level Auditing with SharePoint Server 2007