SPAudit.GetEntries 方法 (SPAuditQuery)
从与指定的查询匹配的审核数据存储在 SharePoint 数据库获取SPAuditEntry对象的集合。
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Function GetEntries ( _
query As SPAuditQuery _
) As SPAuditEntryCollection
用法
Dim instance As SPAudit
Dim query As SPAuditQuery
Dim returnValue As SPAuditEntryCollection
returnValue = instance.GetEntries(query)
public SPAuditEntryCollection GetEntries(
SPAuditQuery query
)
参数
query
类型:Microsoft.SharePoint.SPAuditQuerySPAuditQuery对象,该对象定义的审核数据,则返回的类型。
返回值
类型:Microsoft.SharePoint.SPAuditEntryCollection
保存请求的SPAuditEntry项目SPAuditEntryCollection 。
异常
异常 | 条件 |
---|---|
UnauthorizedAccessException | 调用代码是用户的不是用户的站点管理员的上下文中。 |
ArgumentException | query是空引用(无 在 Visual Basic 中)。 |
备注
更简单的方法,不需要您创建一个SPAuditQuery对象,请参阅GetEntries。
示例
(从Item-Level Auditing with SharePoint Server 2007) 下面的示例演示在使用此方法。
SPSite oSiteCollection = (SPSite)properties.Feature.Parent;
SPAuditQuery oAuditQuery = new SPAuditQuery(oSiteCollection);
oAuditQuery.RestrictToListItem(item);
SPAuditEntryCollection collAuditEntries = oSiteCollection.Audit.GetEntries(oAuditQuery);
foreach (SPAuditEntry oAuditEntry in collAuditEntries) {
// get info from audit log
}
Dim oSiteCollection As SPSite = CType(properties.Feature.Parent, SPSite)
Dim oAuditQuery As New SPAuditQuery(oSiteCollection)
oAuditQuery.RestrictToListItem(item)
Dim collAuditEntries As SPAuditEntryCollection = oSiteCollection.Audit.GetEntries(oAuditQuery)
For Each oAuditEntry As SPAuditEntry In collAuditEntries
' get info from audit log
Next oAuditEntry