SPChangeCollection.IncludesBeginning property
取得值,這個值,指出集合是否包含取自內容資料庫的變更記錄檔開頭的變更。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public ReadOnly Property IncludesBeginning As Boolean
Get
'用途
Dim instance As SPChangeCollection
Dim value As Boolean
value = instance.IncludesBeginning
public bool IncludesBeginning { get; }
Property value
Type: System.Boolean
true如果集合包含的內容資料庫的變更記錄檔 ; 開頭否則, false。
備註
這個屬性會有true只針對集合內SPChangeCollection.CollectionScope取得的值。ContentDB的範圍。換句話說,若要變更從內容資料庫變更記錄檔的開頭,您必須呼叫SPContentDatabase類別的GetChanges()方法。
Examples
下列範例會擷取內容的資料庫變更記錄檔中的後續變更集合的主控台應用程式。為取得每個集合時,應用程式是列印到主控台的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...
請參閱
參照
Microsoft.SharePoint namespace