PHP-将MySQL联系人与Exchange同步 [英] PHP - Syncing MySQL Contacts with Exchange

查看:100
本文介绍了PHP-将MySQL联系人与Exchange同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为PHP Webapp的一部分,我有MySQL联系人表.它集成在整个应用程序中,允许您添加联系人,编辑联系人或将联系人添加为与另一个表的关系.但是,目前它是独立的.该公司希望它与Exchange同步,以便添加到Exchange的联系人将显示在webapp上,并且添加在webapp上的联系人将通过Exchange显示.

As part of a PHP webapp I have MySQL contacts table. It is integrated throughout the app, allowing you add a contact, edit a contact or add a contact as a relation to another table. However, currently it is self-contained. The company would like it to sync with Exchange, so that contacts added to Exchange will show up on the webapp and contacts added on the webapp will show up through Exchange.

所以我有两个问题:1)与Exchange通信2)与Exchange同步.

So I have two problems: 1) communicating with Exchange 2) syncing with Exchange.

就基本通信而言,该库似乎可以对其进行管理 https://github.com/jamesiarmes/php-ews .但是,我对如何管理同步以及没有从哪里开始感到迷茫.

As far as the basic communication goes, it looks like this library will be able to manage it https://github.com/jamesiarmes/php-ews. However, I am quite lost as to how to manage syncing and don't where to start.

推荐答案

用于同步项目的内置方法是通过称为SyncFolderItems的函数.基本上要交换所有东西,包括联系人在内的都是一个文件夹,因此您只需在同步请求中将CONTACTS作为DistinguishedFolderId传递即可.

The build-in way to sync items is via function called SyncFolderItems. Basically to Exchange everything, including contacts is a folder, so you'll just pass CONTACTS as DistinguishedFolderId in your sync request.

同步的工作方式是分批下载最大为512个元素的给定帐户的所有项目,并且在每个批处理之后,它为您提供SyncState作为参考点,Exchange可以知道您从何处退出.因此,它使您能够进行增量同步.

The sync works by donloading all the items for given account in batches of max 512 elements and after each batch it gives you SyncState as a refernce point for Exchange to know where you left off. So it gives you ability to do incremental sync.

现在,那是当然的一种方法,意思是交换->您的数据库.否则,您应该执行原子更新/请求-从数据库更改/添加/删除项目的那一刻起,您应该向Exchange服务器发出足够的请求以保持数据同步,否则在下一个.

Now, that's one way of course, meaning Exchange -> Your DB. The other way it aeound you should preform atomic updates/request - the moment you change/add/delete item form your db you should issue adequate request to Exchange server to keep data in sync, elese it'll be overwritten on your next SyncFolderItems.

您可以在 @ MSDN

如果您想查看SyncFolderItems的示例,可以看看@ Python版本的EWSWrapper ,它是最近添加的.尽管它是python,但是您仍然可以获得如何构造请求/处理响应的基本思想.

If you'd like to see example of SyncFolderItems you can take a look @ python version of EWSWrapper, it's been added in recently. Although it's python, you can still get the basic idea how to construct the request / handle response.

希望这会有所帮助:)

这篇关于PHP-将MySQL联系人与Exchange同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆