打个小广告:作者博客地址:http://nbsanke.top:68
sk-ews是wangzy基于ews(ExchangeWebService)Api二次开发构建出来的基于SpringBoot的Starter,开发者只需要通过maven或gradle或引入lib包形式引入本jar即可快速对ExchangeWebService进行二次开发
目前仅在私服上传,有需要可联系作者qq:1197983391
maven:
com.sanke
sk-ews
0.0.4
gradle:
compile "com.sanke:sk-ews:0.0.4"
sk-ews在使用之前需要注入配置信息(已废弃,0.0.1版本适用)
示例代码如下:
@Bean
public EwsConfigProperties ewsConfigProperties() {
EwsConfigProperties ewsConfigProperties = new EwsConfigProperties();
ewsConfigProperties.setServerUrl("https://dc1.nbsanke.top/EWS/Exchange.asmx");
ewsConfigProperties.setServerHost("dc1.nbsanke.top");
return ewsConfigProperties;
}
在启动类中加上
@ComponentScan("com.sanke")
ews相关接口都在EwsService接口类中
ews相关接口实现都在EwsServiceImpl实现类中
初始化ExchangeService对象需要传入username和password两个参数。sk-ews默认初始化ExchangeService采用Exchange2010_SP2版本,此版本也是Ews提供可用最高版本
初始化ExchangeService接口为:
ExchangeService initExchangeService(String username, String password) throws Exception;
使用示例:
ExchangeService exchangeService = ewsService.initExchangeService("[email protected]", "xxx");
获取一个预约需要传入两个对象:
ExchangeService(ExchangeService服务)
AppointmentBean(预约参数Bean)
获取一个预约初始化AppointmentBean必传参数有一个:
appointmentId(会议Id) 类型:String
获取一个Appointment接口为:
Appointment getOneAppointment(ExchangeService exchangeService, AppointmentBean appointmentBean) throws Exception;
初始化AppointmentBean示例:
AppointmentBean appointmentBean = AppointmentBean.builder()
.appointmentId("xxx")
.build();
获取一个预约示例:
@Autowired
private EwsService ewsService;
Appoinetment appointment = ewsService.getOneApppinement(exchangeService, appointmentBean);
列出指定时间内预约需要传入两个对象:
ExchangeService(ExchangeService服务)
AppointmentBean(预约参数Bean)
获取一个预约初始化AppointmentBean必传参数有两个:
beginTime(开始时间) 类型:Date
endTime(结束时间) 类型:Date
获取指定时间内预约接口为:
List listAppointment(ExchangeService exchangeService,AppointmentBean appointmentBean) throws Exception;
初始化AppointmentBean示例:
AppointmentBean appointmentBean = AppointmentBean.builder()
.beginTime(new Date(new Date().getTime() - 1000 * 3600 *24))
.endTIme(new Date(new Date().getTime() + 1000 * 3600 *24))
.build();
获取指定时间内预约示例:
@Autowired
private EwsService ewsService;
List appointments = ewsService.listAppointment(exchangeService, appointmentBean);
创建预约需要传入两个对象:
ExchangeService(ExchangeService服务)
AppointmentBean(预约参数Bean)
创建预约初始化AppointmentBean必传参数有:
beginTime(开始时间) 类型:Date
endTime(结束时间) 类型:Date
subject(预约主题) 类型:String
attendees(与会人) 类型:List<String
> (注意:会议室在预约中是以与会人形式存在,所以与会人中必有会议室)
location(地点) 类型:String
可传参数有:
content(预约内容) 类型:String
importance(重要性) 类型:Importance(枚举类)
注:Importance有三个成员变量
1、Low (低)
2、Normal (中)
3、Heigh (高)
创建预约接口为:
Appointment createAppointment(ExchangeService exchangeService, AppointmentBean appointmentBean) throws Exception;
初始化AppointmentBean示例:
AppointmentBean appointmentBean = AppointmentBean.builder()
.beginTime(new Date(new Date().getTime() + 1000 * 3600))
.endTIme(new Date(new Date().getTime() + 1000 * 3600))
.content("胡泰迪")
.subject("一起来学Linux")
.importance(Importance.Normal)
.attendees(attendees)
.location("会议室101")
.build();
创建预约示例:
@Autowired
private EwsService ewsService;
Appointment appointment = ewsService.createAppointment(exchangeService, appointmentBean);
更新预约需要传入两个对象:
ExchangeService(ExchangeService服务)
AppointmentBean(预约参数Bean)
更新预约AppointmentBean必传参数有一个:
appointmentId(会议Id) 类型:String
更新预约AppointmentBean可传参数:
beginTime(开始时间) 类型:Date
endTime(结束时间) 类型:Date
subject(预约主题) 类型:String
attendees(与会人) 类型:List<String
> (注意:会议室在预约中是以与会人形式存在,所以与会人中必有会议室)
location(地点) 类型:String
content(预约内容) 类型:String
importance(重要性) 类型:Importance(枚举类)
注:Importance有三个成员变量
1、Low (低)
2、Normal (中)
3、Heigh (高)
更新预约接口为:
Appointment updateAppointment(ExchangeService exchangeService, AppointmentBean appointmentBean) throws Exception;
初始化AppointmentBean与创建预约一样
更新预约示例:
@Autowired
private EwsService ewsService;
Appointment appointment = ewsService.updateAppointment(exchangeService, appointmentBean);
获取一个预约需要传入两个对象:
ExchangeService(ExchangeService服务)
AppointmentBean(预约参数Bean)
拒绝会议AppointmentBean必传参数有一个:
appointmentId(会议Id) 类型:String
拒绝预约接口为:
Appointment declineAppointment(ExchangeService exchangeService, AppointmentBean appointmentBean) throws Exception;
初始化AppointmentBean与获取一个预约一样
拒绝预约示例:
@Autowired
private EwsService ewsService;
ewsService.declineAppointment(exchangeService, appointmentBean);