SPChangeCollection.IncludesBeginning 属性

获取一个值,指示集合是否包含来自内容数据库的更改日志的开头的更改。

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public ReadOnly Property IncludesBeginning As Boolean
    Get
用法
Dim instance As SPChangeCollection
Dim value As Boolean

value = instance.IncludesBeginning
public bool IncludesBeginning { get; }

属性值

类型:System.Boolean
true如果集合包含的内容数据库的更改日志 ; 开头否则为false。

备注

此属性将包含true仅为集内SPChangeCollection.CollectionScope获取一个值。ContentDB范围。换句话说,若要更改获取从内容数据库的更改日志的开头,必须调用SPContentDatabase类的GetChanges()方法。

示例

下面的示例是一个从内容数据库的更改日志中检索连续的更改集合的控制台应用程序。获取每个集合,如应用程序将打印到控制台IncludesBeginning属性的值。

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;

               Console.WriteLine(changes.IncludesBeginning);

               // 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

            Console.WriteLine(changes.IncludesBeginning)

            ' 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

SharePoint Foundation很低安装针对运行应用程序时,以下输出将打印到控制台。

True
False
False
2,301 changes

Press ENTER to continue...

另请参阅

引用

SPChangeCollection 类

SPChangeCollection 成员

Microsoft.SharePoint 命名空间

其他资源

Using the Change Log