Share via


SPChangeTokenCollection.Delete Method

Deletes the change token object with the specified ID from the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub Delete ( _
    scopeId As Guid _
)
'Usage
Dim instance As SPChangeTokenCollection
Dim scopeId As Guid

instance.Delete(scopeId)
public void Delete(
    Guid scopeId
)

Parameters

  • scopeId
    Type: System.Guid

    The ID of the change token to delete.

Remarks

If the collection does not contain a change token with the specified scopeId value, the collection remains unchanged. No exception is thrown.

You can get a value to pass as an argument to this method by accessing the Id property of the object to which the change token applies. For example, if you have a collection of change tokens for several content databases and you decide not to monitor changes for a particular database, you can delete its token from the collection by passing the GUID that identifies the content database. To get this GUID, first cast the SPContentDatabase object as type SPPersistedObject, and then access the resulting object’s Id property. The following code example demonstrates this technique.

Dim db As SPPersistedObject = CType(oSPSite.ContentDatabase, SPPersistedObject)
oChangeTokenCollection.Delete(db.Id)
SPPersistedObject db = oSPSite.ContentDatabase as SPPersistedObject;
oChangeTokenCollection.Delete(db.Id);

The cast is necessary because the Id property of the SPContentDatabase class is obsolete.

See Also

Reference

SPChangeTokenCollection Class

SPChangeTokenCollection Members

Microsoft.SharePoint Namespace

SPContentDatabase

SPPersistedObject