Share via


ChangeUnitListFilterInfo Constructor (SyncIdFormatGroup, ICollection<SyncId>, Boolean)

Initializes a new instance of the ChangeUnitListFilterInfo class that contains the specified ID format schema, the collection of change unit IDs that indicate which change units are included by this filter, and a value that indicates whether the filter applies to all items in the scope.

Namespace:  Microsoft.Synchronization
Assembly:  Microsoft.Synchronization (in Microsoft.Synchronization.dll)

Syntax

'Declaration
Public Sub New ( _
    idFormats As SyncIdFormatGroup, _
    changeUnitIds As ICollection(Of SyncId), _
    appliesToAllItems As Boolean _
)
'Usage
Dim idFormats As SyncIdFormatGroup
Dim changeUnitIds As ICollection(Of SyncId)
Dim appliesToAllItems As Boolean

Dim instance As New ChangeUnitListFilterInfo(idFormats, _
    changeUnitIds, appliesToAllItems)
public ChangeUnitListFilterInfo(
    SyncIdFormatGroup idFormats,
    ICollection<SyncId> changeUnitIds,
    bool appliesToAllItems
)
public:
ChangeUnitListFilterInfo(
    SyncIdFormatGroup^ idFormats, 
    ICollection<SyncId^>^ changeUnitIds, 
    bool appliesToAllItems
)
new : 
        idFormats:SyncIdFormatGroup * 
        changeUnitIds:ICollection<SyncId> * 
        appliesToAllItems:bool -> ChangeUnitListFilterInfo
public function ChangeUnitListFilterInfo(
    idFormats : SyncIdFormatGroup, 
    changeUnitIds : ICollection<SyncId>, 
    appliesToAllItems : boolean
)

Parameters

  • appliesToAllItems
    Type: System.Boolean
    true when the filter applies to all items in the scope. Otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

idFormats or changeUnitIds is a null reference (Nothing in Visual Basic).

ArgumentException

changeUnitIds is empty.

Examples

The following example builds a list of change unit IDs to include in synchronization, and uses the list of change unit IDs to create a ChangeUnitListFilterInfo object. The ChangeUnitListFilterInfo object is passed to the GetFilteredChangeBatch method to retrieve a filtered change batch from the metadata storage service.

Public Sub SetContactFieldsToInclude(ByVal includedFields As Contact.ChangeUnitFields())
    ' Translate the array of fields to a list of IDs.
    _includedChangeUnits = New List(Of SyncId)(includedFields.Length)
    For iField As Integer = 0 To includedFields.Length - 1
        _includedChangeUnits.Add(New SyncId(CByte(includedFields(iField))))
    Next

    _isFiltered = True
End Sub
Public Overrides Function GetChangeBatch(ByVal batchSize As UInteger, ByVal destinationKnowledge As SyncKnowledge, ByRef changeDataRetriever As Object) As ChangeBatch
    ' Return this object as the IChangeDataRetriever object that is called to retrieve item data.
    changeDataRetriever = Me

    Dim retrievedBatch As ChangeBatch
    If _isFiltered Then
        ' Use the metadata storage service to get a filtered batch of changes.
        Dim filterInfo As New ChangeUnitListFilterInfo(IdFormats, _includedChangeUnits, True)
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge, filterInfo, Nothing)
    Else
        ' Use the metadata storage service to get a batch of changes.
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge)
    End If

    Return retrievedBatch
End Function
public void SetContactFieldsToInclude(Contact.ChangeUnitFields[] includedFields)
{
    // Translate the array of fields to a list of IDs.
    _includedChangeUnits = new List<SyncId>(includedFields.Length);
    for (int iField = 0; iField < includedFields.Length; iField++)
    {
        _includedChangeUnits.Add(new SyncId((byte)includedFields[iField]));
    }

    _isFiltered = true;
}
public override ChangeBatch GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever)
{
    // Return this object as the IChangeDataRetriever object that is called to retrieve item data.
    changeDataRetriever = this;

    ChangeBatch retrievedBatch;
    if (_isFiltered)
    {
        // Use the metadata storage service to get a filtered batch of changes.
        ChangeUnitListFilterInfo filterInfo = new ChangeUnitListFilterInfo(IdFormats, _includedChangeUnits, true);
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge,
            filterInfo, null);
    }
    else
    {
        // Use the metadata storage service to get a batch of changes.
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge);
    }

    return retrievedBatch;
}

See Also

Reference

ChangeUnitListFilterInfo Class

ChangeUnitListFilterInfo Overload

Microsoft.Synchronization Namespace