本文整理汇总了C#中ExchangeService.SyncFolderItems方法的典型用法代码示例。如果您正苦于以下问题:C# ExchangeService.SyncFolderItems方法的具体用法?C# ExchangeService.SyncFolderItems怎么用?C# ExchangeService.SyncFolderItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExchangeService
的用法示例。
在下文中一共展示了ExchangeService.SyncFolderItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncContacts
private void SyncContacts(ExchangeService service)
{
// Initialize the flag that will indicate when there are no more changes.
bool isEndOfChanges = false;
// Call SyncFolderItems repeatedly until no more changes are available.
// sSyncState represents the sync state value that was returned in the prior synchronization response.
do
{
ChangeCollection<ItemChange> icc = service.SyncFolderItems(new FolderId(WellKnownFolderName.Contacts), PropertySet.FirstClassProperties, null, 512, SyncFolderItemsScope.NormalItems, sSyncState);
if (icc.Count == 0)
{
Console.WriteLine("There are no item changes to synchronize.");
}
else
{
foreach (ItemChange ic in icc)
{
if (ic.ChangeType == ChangeType.Create)
{
Contact contacts = Contact.Bind(service, ic.ItemId);
contact.AddContact(contacts);
contact.PushUpdatesToAuditTable("Added the record", contacts);
}
else if (ic.ChangeType == ChangeType.Update)
{
Contact contacts = Contact.Bind(service, ic.ItemId);
contact.UpdateContact(contacts);
contact.PushUpdatesToAuditTable("Updated the record", contacts);
}
else if (ic.ChangeType == ChangeType.Delete)
{
contact.PushUpdatesToAuditTable("Deleted the record", ic.ItemId);
contact.DeleteContact(ic.ItemId);
}
else if (ic.ChangeType == ChangeType.Delete)
{
//TODO: Update the item's read flag on the client.
}
}
}
// Save the sync state for use in future SyncFolderHierarchy calls.
sSyncState = icc.SyncState;
WriteSyncState();
if (!icc.MoreChangesAvailable)
{
isEndOfChanges = false;
}
} while (isEndOfChanges);
}