SPChangeCollection.LastChangeToken - Propriété

Obtient le jeton de modification qui correspond à la dernière modification de la collection.

Espace de noms :  Microsoft.SharePoint
Assembly :  Microsoft.SharePoint (dans Microsoft.SharePoint.dll)

Syntaxe

'Déclaration
Public ReadOnly Property LastChangeToken As SPChangeToken
    Get
'Utilisation
Dim instance As SPChangeCollection
Dim value As SPChangeToken

value = instance.LastChangeToken
public SPChangeToken LastChangeToken { get; }

Valeur de propriété

Type : Microsoft.SharePoint.SPChangeToken
Objet SPChangeToken qui représente le dernier jeton de modification.

Remarques

Le jeton de modification qui est retourné est la valeur de la propriété ChangeToken de l'objet SPChange indexé à Count – 1 dans la collection à modifier. Lors de l'extraction de modifications par lots, vous pouvez utiliser ce jeton comme point de départ pour le lot suivant.

Exemples

L'exemple suivant est une application console simple qui montre comment récupérer toutes les modifications du journal de modification en cours.

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

Voir aussi

Référence

SPChangeCollection classe

SPChangeCollection - Membres

Microsoft.SharePoint - Espace de noms

FetchLimit

Autres ressources

Using the Change Log