import groovyx.net.http.*class ExchangeSyncService { static transactional = true static DOMAIN = 'my-domain' static CTMS_SYNC_USERNAME = 'usr' static CTMS_SYNC_PASSWORD = 'pwd' static HTTP_BUILDER_POOL = [:] private static getHttpBuilder(username) { HTTP_BUILDER_POOL[username] ?: ( HTTP_BUILDER_POOL[username] = new HTTPBuilder( "https://webmail.${DOMAIN}.com" ) ) } def sendAppointment(params) { def username = CTMS_SYNC_USERNAME, password = CTMS_SYNC_PASSWORD _login(username, password) getHttpBuilder(username).post( path: "/Exchange/${username}/日历", body: getAppointmentBody(params)) {res-> println res.statusLine.statusCode } } def saveTask(params) { def username = params.session.user?.username, password = params.session.user?.password _login(username, password) getHttpBuilder(username).post( path: "/Exchange/${username}/任务", body: getTaskBody(params)) {res-> println res.statusLine.statusCode } } private _login(username, password) { getHttpBuilder(username).post( path: '/exchweb/bin/auth/owaauth.dll', body: [destination:"https://webmail.${DOMAIN}.com/Exchange", flags:'0', username:"${DOMAIN}/${username}", password:password] ) {res-> if( res.statusLine.statusCode == 302 ) { println "${username} logged in to exchange server successfully." } } } private getAppointmentBody(m) { ["Cmd": "sendappt","CmdReferring": "new","Embedded": "0","FORMTYPE": "appointment","Importance": "2","Optional": m.optional,//"sam.ds.chen@gmail.com; somebody@grs-cro.com","ReadForm": "1","Required": m.required,//"sachen@grs-cro.com","Resource": m.resource,//"sam.ds.chen@hotmail.com","urn:schemas:calendar:alldayevent": "1","urn:schemas:calendar:busystatus": "BUSY","urn:schemas:calendar:dtend": m.dtend,//"2011-09-21T16:00:00.000Z", //bug:总是用Exchange服务器所在的美国时区"urn:schemas:calendar:dtstart": m.dtstart,//"2011-09-21T15:30:00.000Z", //bug:总是用Exchange服务器所在的美国时区"urn:schemas:calendar:location": "","urn:schemas:calendar:reminderoffset": m.reminderoffset,//"900","urn:schemas:calendar:responserequested": "0","urn:schemas:httpmail:importance": "1","urn:schemas:httpmail:subject": m.subject,//"(sent by ctmssync)","urn:schemas:httpmail:textdescription": "Accept it to get it on your calendar" ] } private getTaskBody(m) { ["Cmd": "savetask","CmdReferring": "new","Embedded": "0","FORMTYPE": "task","MsgClass": "IPM.Task","ReadForm": "1","SENDUPDATE": "0","exception": "","http://schemas.microsoft.com/exchange/tasks/percentcomplete": "0","http://schemas.microsoft.com/exchange/tasks/resetreminder": "","http://schemas.microsoft.com/mapi/reminderset": "1","task_due": m.task_due,//"2011-08-04T00:00:00.000Z","task_remindertime": m.remindertime,//"2011-10-06T08:00:00.000Z","task_start": m.task_start,//"2011-10-04T00:00:00.000Z","task_status": "0","urn:schemas:httpmail:importance": "1","urn:schemas:httpmail:subject": m.subject,//"Title_2","urn:schemas:httpmail:textdescription": "This is a task created by SmartCTMS on behalf of you" ] }}
详细解决方案
没有EWS,如何把其他系统的Calendar同步到Exchange?(2)
热度:7381 发布时间:2013-02-26 00:00:00.0
相关解决方案
- calendar 简单有关问题!有点晕了
- exchange server 2000提供全部用户邮件到达的java api吗
- ~关于java.util.Calendar.setTime(Unknown Source)的有关问题 !
- Calendar 与 java.sql.Date格式的变换
- Calendar 下显示的都是中文,如何样改成日文
- Calendar 上显示的都是中文,如何样改成日文
- Calendar 有关问题
- Calendar 控件日期格式有关问题
- 小弟我在用到:Web Calendar ver 3.0 网页日历控件时的有关问题
- AJAX 中 calendar 日历控件怎么能让当前日之前的日期成灰色不能选择,只能选择当前日和以后的日期
- Calendar 自动刷新解决方案
- 请问一上大家,email邮箱的pop3, smtp, exchange, 有什么不同
- 高手!exchange outlook07里的邮件无法分类
- Oralce EXCHANGE PARTITION 的示范
- Exchange 2003 And Active Directory解决方案
- exchange 2000邮件发送后还是不停的发,是什么原因?解决办法
- exchange server中,當發1個郵件給某人時,可否同時發給其它2人或多人?
- Exchange Server是不是集成自己的Web Mail
- Exchange 2003下自动存储几个特定帐户的附件
- Exchange TransportSink存附件到网络硬盘,该如何处理
- Exchange 2000 安装不下错误
- exchange Server从哪儿可以得到
- EXCHANGE TO EXCHANGE(同一个域中),该怎么解决
- 急觅 Exchange server 2007的教材编写者
- exchange 2003 公用文件夹丢掉
- Exchange 2007 跟ISA 2006
- exchange 2000 面试时碰到的几个小问题,
- exchange 2007 没法发邮件
- ,exchange 2003怎么在一个域环境上布置多台邮件服务器
- exchange 2007数据库迁移到不同的服务器下