Compartir a través de


de la propiedad SPAudit.AuditFlags

Obtiene o establece un valor que indica qué tipos de eventos y acciones se auditan.

Espacio de nombres:  Microsoft.SharePoint
Ensamblado:  Microsoft.SharePoint (en Microsoft.SharePoint.dll)

Sintaxis

'Declaración
Public Property AuditFlags As SPAuditMaskType
    Get
    Set
'Uso
Dim instance As SPAudit
Dim value As SPAuditMaskType

value = instance.AuditFlags

instance.AuditFlags = value
public SPAuditMaskType AuditFlags { get; set; }

Valor de propiedad

Tipo: Microsoft.SharePoint.SPAuditMaskType
SPAuditMaskType que codifica de manera bit a bit de los eventos y acciones que se auditan.

Comentarios

Usar operadores lógicos bit a bit para combinar varios indicadores SPAuditMaskType .

Llamar a Update inmediatamente después de realizar cambios en AuditFlags.

Ejemplos

El ejemplo siguiente muestra cómo cambiar la configuración de auditoría de un elemento de lista. (El item es un objeto de tipo SPListItem).

// Turns on auditing of user views and deletions of items. 
oListItem.Audit.AuditFlags = (SPAuditMaskType.View | SPAuditMaskType.Delete);
oListItem.Audit.Update();

// Turns on auditing of user views of the list item without changing
// any other existing auditing settings.
oListItem.Audit.AuditFlags = (item.Audit.AuditFlags | SPAuditMaskType.View);
oListItem.Audit.Update();

// Turns off auditing of user views of the list item without changing
// any other existing auditing settings.
oListItem.Audit.AuditFlags = (item.Audit.AuditFlags & 
                        (SPAuditMaskType.All ^ SPAuditMaskType.View));
oListItem.Audit.Update();

// Turns on auditing of all types of events and actions relevant to 
// the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.All;
oListItem.Audit.Update();

// Turns off all auditing of the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.None;
oListItem.Audit.Update();
' Turns on auditing of user views and deletions of items. 
oListItem.Audit.AuditFlags = (SPAuditMaskType.View Or SPAuditMaskType.Delete)
oListItem.Audit.Update()

' Turns on auditing of user views of the list item without changing
' any other existing auditing settings.
oListItem.Audit.AuditFlags = (item.Audit.AuditFlags Or SPAuditMaskType.View)
oListItem.Audit.Update()

' Turns off auditing of user views of the list item without changing
' any other existing auditing settings.
oListItem.Audit.AuditFlags = (item.Audit.AuditFlags And (SPAuditMaskType.All Xor SPAuditMaskType.View))
oListItem.Audit.Update()

' Turns on auditing of all types of events and actions relevant to 
' the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.All
oListItem.Audit.Update()

' Turns off all auditing of the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.None
oListItem.Audit.Update()

El ejemplo siguiente ( Item-Level Auditing with SharePoint Server 2007), muestra esta propiedad en uso.

public override void FeatureActivated(SPFeatureReceiverProperties properties)  {

  SPSite oSiteCollection = (SPSite)properties.Feature.Parent;
  // Turn on auditing flags.
  oSiteCollection.Audit.AuditFlags = SPAuditMaskType.All;
  oSiteCollection.Audit.Update();

  // Modify title of top-level site.
  SPWeb oWebsiteRoot = oSiteCollection.RootWeb;
  oWebsiteRoot.Title += " (audited)";
  oWebsiteRoot.Update();

  SPListTemplate oListTemplate = oWebsiteRoot.ListTemplates["Document Library"];
  Guid docLibID = oWebsiteRoot.Lists.Add("AuditLogs", "Library for Audit Log Workbooks", oListTemplate);
  SPList oListDocLib = oWebsiteRoot.Lists[docLibID];
  oListDocLib.OnQuickLaunch = true;
  oListDocLib.Update();
}
Public Overrides Sub FeatureActivated(ByVal properties As SPFeatureReceiverProperties)

  Dim oSiteCollection As SPSite = CType(properties.Feature.Parent, SPSite)
  ' Turn on auditing flags.
  oSiteCollection.Audit.AuditFlags = SPAuditMaskType.All
  oSiteCollection.Audit.Update()

  ' Modify title of top-level site.
  Dim oWebsiteRoot As SPWeb = oSiteCollection.RootWeb
  oWebsiteRoot.Title &= " (audited)"
  oWebsiteRoot.Update()

  Dim oListTemplate As SPListTemplate = oWebsiteRoot.ListTemplates("Document Library")
  Dim docLibID As Guid = oWebsiteRoot.Lists.Add("AuditLogs", "Library for Audit Log Workbooks", oListTemplate)
  Dim oListDocLib As SPList = oWebsiteRoot.Lists(docLibID)
  oListDocLib.OnQuickLaunch = True
  oListDocLib.Update()
End Sub

Vea también

Referencia

clase SPAudit

Miembros SPAudit

Espacio de nombres Microsoft.SharePoint

Otros recursos

Item-Level Auditing with SharePoint Server 2007