IFilteredReplicaNotifyingChangeApplierTarget::GetNewMoveInItems Method
Gets a list of item IDs that identify the items that are in the filter and are not contained in the specified knowledge.
Assembly: Microsoft.Synchronization (in Microsoft.Synchronization.dll)
Parameters
- baseKnowledge
- Type: Microsoft.Synchronization::SyncKnowledge
The returned list of item IDs identifies items that are in the filter and are not contained in this knowledge.
Return Value
Type: System.Collections.Generic::IEnumerator<SyncId>A list of item IDs that identify the items that are in the filter and are not contained in baseKnowledge.
This method is used by the change applier to determine which items have moved into the filter after the knowledge specified by baseKnowledge was recorded. For example, a replica that stores media files is filtered to only store data for files that are rated as three stars or better. A file is rated as two stars when baseKnowledge is recorded. The user changes the rating on the file to four stars. The file has moved into the filter and must be included in the list that is returned from this method.
The following example enumerates all items in the metadata store. An item is added to the list of new move-in items when the item is in the filter used for synchronization, and the move version of the item in relation to the filter is not contained in the specified base knowledge.
Public Function GetNewMoveInItems(ByVal baseKnowledge As SyncKnowledge) As IEnumerator(Of SyncId) Implements IFilteredReplicaNotifyingChangeApplierTarget.GetNewMoveInItems Dim newMoveInIdList As New List(Of SyncId)() Dim allItems As IEnumerable(Of ItemMetadata) = _ContactStore.ContactReplicaMetadata.GetAllItems(False) Dim mappedBaseKnowledge As SyncKnowledge = _ContactStore.ContactReplicaMetadata.GetKnowledge().MapRemoteKnowledgeToLocal(baseKnowledge) For Each itemMeta As ItemMetadata In allItems Dim filterChange As FilterChange = _ContactStore.GetTrackedFilterMetadata(itemMeta, _filterForSync) If filterChange.IsMoveIn Then If Not mappedBaseKnowledge.Contains(_ContactStore.ContactReplicaMetadata.ReplicaId, itemMeta.GlobalId, filterChange.MoveVersion) Then newMoveInIdList.Add(itemMeta.GlobalId) End If End If Next Return newMoveInIdList.GetEnumerator() End Function
public IEnumerator<SyncId> GetNewMoveInItems(SyncKnowledge baseKnowledge)
{
List<SyncId> newMoveInIdList = new List<SyncId>();
IEnumerable<ItemMetadata> allItems = _ContactStore.ContactReplicaMetadata.GetAllItems(false);
SyncKnowledge mappedBaseKnowledge = _ContactStore.ContactReplicaMetadata.GetKnowledge().MapRemoteKnowledgeToLocal(baseKnowledge);
foreach (ItemMetadata itemMeta in allItems)
{
FilterChange filterChange = _ContactStore.GetTrackedFilterMetadata(itemMeta, _filterForSync);
if (filterChange.IsMoveIn)
{
if (!mappedBaseKnowledge.Contains(_ContactStore.ContactReplicaMetadata.ReplicaId, itemMeta.GlobalId, filterChange.MoveVersion))
{
newMoveInIdList.Add(itemMeta.GlobalId);
}
}
}
return newMoveInIdList.GetEnumerator();
}