de la propiedad SPChangeCollection.LastChangeToken
Obtiene el token de cambio que se corresponde con el último cambio en la colección.
Espacio de nombres: Microsoft.SharePoint
Ensamblado: Microsoft.SharePoint (en Microsoft.SharePoint.dll)
Sintaxis
'Declaración
Public ReadOnly Property LastChangeToken As SPChangeToken
Get
'Uso
Dim instance As SPChangeCollection
Dim value As SPChangeToken
value = instance.LastChangeToken
public SPChangeToken LastChangeToken { get; }
Valor de propiedad
Tipo: Microsoft.SharePoint.SPChangeToken
Un objeto SPChangeToken que representa el último token de cambio.
Comentarios
El token de cambio que se devuelve es el valor de la propiedad ChangeToken del objeto SPChange encuentra Count – 1 en la colección de cambios en el índice. Cuando extraiga los cambios en lotes, puede utilizar este símbolo (token) como el punto de partida para el siguiente lote.
Ejemplos
En el siguiente ejemplo es una aplicación de consola sencilla que muestra cómo recuperar todos los cambios desde el registro de cambios actual.
using System;
using Microsoft.SharePoint;
namespace Test
{
class ConsoleApp
{
static void Main(string[] args)
{
using (SPSite siteCollection = new SPSite("https://localhost"))
{
long total = 0;
SPChangeToken token = null;
// Get the first batch of changes.
SPChangeCollection changes = siteCollection.ContentDatabase.GetChanges(token);
// Loop until the end of the log is reached.
while (changes.Count > 0)
{
total += changes.Count;
// Go get another batch.
token = changes.LastChangeToken;
changes = siteCollection.ContentDatabase.GetChanges(token);
}
Console.WriteLine("{0:#,#} changes", total);
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}
Imports System
Imports Microsoft.SharePoint
Module ConsoleApp
Sub Main()
Using siteCollection As SPSite = New SPSite("https://localhost")
Dim total As Long = 0
Dim token As SPChangeToken = Nothing
' Get the first batch of changes.
Dim changes As SPChangeCollection = siteCollection.ContentDatabase.GetChanges(token)
' Loop until the end of the log is reached.
While changes.Count > 0
total += changes.Count
' Go get another batch.
token = changes.LastChangeToken
changes = siteCollection.ContentDatabase.GetChanges(token)
End While
Console.WriteLine("{0:#,#} changes", total)
End Using
Console.Write(vbCrLf + "Press ENTER to continue...")
Console.ReadLine()
End Sub
End Module
Vea también
Referencia
Espacio de nombres Microsoft.SharePoint