Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Help, I can't getRequiredAttendees via EWS api

$
0
0

hi,

I download the EWS api via github

The EWS api vesion is 2.1-SNAPSHOT.

My exchange server is 2016.

After i create an appointment in my outlook canlendar, i try to get it via EWS API

Here is my code,

    public static void getAppointmentByEmai(String email) throws Exception {
        ExchangeService service = getService();
        Date start = new Date();
        Calendar cal = Calendar.getInstance();
        cal.setTime(start);
        cal.add(Calendar.DAY_OF_MONTH, 30);
        Date end = cal.getTime();
        CalendarView cView = new CalendarView(start, end);
        //指定要查看的邮箱
        FolderId folderId = new FolderId(WellKnownFolderName.Calendar, new Mailbox(email));
        FindItemsResults<Appointment> findResults = null;
        try {
            findResults = service.findAppointments(folderId, cView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        ArrayList<Appointment> appointmentItems = findResults == null ? null : findResults.getItems();
        if (appointmentItems != null && appointmentItems.size() > 0) {
            for (Appointment ap : appointmentItems) {
                String subject = ap.getSubject();
                if(StringUtils.isNotEmpty(subject) && subject.startsWith("已取消")){
                    continue;
                }
                PropertyBag pb = ap.getPropertyBag();
                Map<PropertyDefinition, Object> map = pb.getProperties();
                for (PropertyDefinition pd : map.keySet()) {
                    System.out.println(pd.getName() + " : " + map.get(pd).toString());
                }
                System.out.println("主题[" + subject + "]");
                System.out.println("开始时间[" + ap.getStart() + "]");
                System.out.println("结束时间[" + ap.getEnd() + "]");
                System.out.println("组织者[" + ap.getOrganizer().getName() + "]");
                System.out.println("必须参会者[ " + ap.getRequiredAttendees().getItems() + " ]");
                System.out.println("可选参会者[ " + ap.getOptionalAttendees().getItems() + " ]");
                System.out.println("地点[" + ap.getLocation() + "]");
                System.out.println("创建时间[" + ap.getICalDateTimeStamp() + "]");
                System.out.println("Recurrence[" + ap.getICalRecurrenceId() + "]");
            }
        }
    }

but I cannot get RequiredAttendees and OptionalAttendees,

主题[新OA规划]
开始时间[Wed Aug 14 18:00:00 CST 2019]
结束时间[Wed Aug 14 20:00:00 CST 2019]
组织者[zhuhua]
必须参会者[ [] ]
可选参会者[ [] ]
地点[视频/SFBVideo2F-1‎]
创建时间[Tue Aug 06 09:53:00 CST 2019]

please help me, thank you.



Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>