当前位置: 首页>>代码示例>>C#>>正文


C# ExchangeService.SyncFolderItems方法代码示例

本文整理汇总了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);
        }
开发者ID:James91,项目名称:Exchange-Find-Contacts,代码行数:52,代码来源:Program.cs


注:本文中的ExchangeService.SyncFolderItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。