SPChangeQuery.SystemUpdate property
Obtém ou define um valor de Boolean que especifica se as modificações do sistema aos objetos são incluídas na consulta.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
Public Property SystemUpdate As Boolean
Get
Set
'Uso
Dim instance As SPChangeQuery
Dim value As Boolean
value = instance.SystemUpdate
instance.SystemUpdate = value
public bool SystemUpdate { get; set; }
Property value
Type: System.Boolean
true para incluir atualizações de sistema; Caso contrário, false. O padrão é false.
Comentários
Esse tipo de alteração é registrado quando um objeto é modificado sem alterar sua propriedade Modified ou Modified By . Você pode obter a hora da alteração da propriedade SPChange.Time .
Examples
O exemplo a seguir é um aplicativo de console que consulta o log de alteração para atualização do sistema para itens na lista de informações de usuário de um site.
Imports System
Imports Microsoft.SharePoint
Module ConsoleApp
Sub Main()
Using siteCollection As SPSite = New SPSite("https://localhost")
Using webSite As SPWeb = siteCollection.RootWeb
' Construct a query.
Dim query As New SPChangeQuery(False, False)
' Set a limit on the number of changes returned on a single trip.
query.FetchLimit = 500
' object type
query.Item = True
' change type.
query.SystemUpdate = True
' list to query
Dim list As SPList = webSite.Lists("User Information List")
' Convert to local time.
Dim timeZone As SPTimeZone = webSite.RegionalSettings.TimeZone
Dim total As Integer = 0
' Loop until we reach the end of the log.
While True
Dim changes As SPChangeCollection = list.GetChanges(query)
total += changes.Count
For Each change As SPChangeItem In changes
' Get the item title.
Dim itemName As String = String.Empty
Try
Dim item As SPListItem = list.GetItemByUniqueId(change.UniqueId)
itemName = item.Name
Catch ex As ArgumentException
itemName = "Item not found"
End Try
' Write to the console.
Console.WriteLine(vbCrLf + "Date: {0}", _
timeZone.UTCToLocalTime(change.Time).ToString())
Console.WriteLine("Change: {0}", change.ChangeType)
Console.WriteLine("Item: {0}", itemName)
Next change
' Break out of loop if we have the last batch.
If changes.Count < query.FetchLimit Then
Exit While
End If
' Otherwise, go get another batch.
query.ChangeTokenStart = changes.LastChangeToken
End While
Console.WriteLine(vbCrLf + "Total of {0} changes", total)
End Using
End Using
Console.Write(vbCrLf + "Press ENTER to continue...")
Console.ReadLine()
End Sub
End Module
using System;
using Microsoft.SharePoint;
namespace Test
{
class ConsoleApp
{
static void Main(string[] args)
{
using (SPSite siteCollection = new SPSite("https://localhost"))
{
using (SPWeb webSite = siteCollection.RootWeb)
{
// Construct a query.
SPChangeQuery query = new SPChangeQuery(false, false);
// Set a limit on the number of changes returned on a single trip.
query.FetchLimit = 500;
// object type
query.Item = true;
// change type
query.SystemUpdate = true;
// list to query
SPList list = webSite.Lists["User Information List"];
// Convert to local time.
SPTimeZone timeZone = webSite.RegionalSettings.TimeZone;
int total = 0;
// Loop until we reach the end of the log.
while (true)
{
SPChangeCollection changes = list.GetChanges(query);
total += changes.Count;
foreach (SPChangeItem change in changes)
{
// Get the item title.
string itemName = String.Empty;
try
{
SPListItem item = list.GetItemByUniqueId(change.UniqueId);
itemName = item.Name;
}
catch (ArgumentException)
{
itemName = "Item not found";
}
// Write to the console.
Console.WriteLine("\nDate: {0}",
timeZone.UTCToLocalTime(change.Time).ToString());
Console.WriteLine("Change: {0}", change.ChangeType);
Console.WriteLine("Item: {0}", itemName);
}
// Break out of loop if we have the last batch.
if (changes.Count < query.FetchLimit)
break;
// Otherwise, go get another batch.
query.ChangeTokenStart = changes.LastChangeToken;
}
Console.WriteLine("\nTotal changes = {0:#,#}", total);
}
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}