When I use the official ews Java API and demo call interface to retrieve the busy status of other users, I always report error 404 ews-java-api

... Availability Service The EWS Java API makes it very easy to consume the Availability service. The Availability service makes it possible to retrieve free/busy information for users for whom the caller does not necessarily have access rights. It also provides meeting time suggestions.

The following example shows how to call the Availability service by using the EWS Java API.

// Create a list of attendees for which to request availability
// information and meeting time suggestions.

List<AttendeeInfo> attendees = new ArrayList<AttendeeInfo>();
attendees.add(new AttendeeInfo("[email protected]"));
attendees.add(new AttendeeInfo("[email protected]"));

SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");

//minimum time frame allowed by API is 24 hours
Date start = formatter.parse("2010/05/18"); 
Date end = formatter.parse("2010/05/19");

// Call the availability service.
GetUserAvailabilityResults results = service.getUserAvailability(
    attendees,
    new TimeWindow(start, end),
    AvailabilityData.FreeBusyAndSuggestions);

// Output attendee availability information.
int attendeeIndex = 0;

for (AttendeeAvailability attendeeAvailability : results.getAttendeesAvailability()) {
    System.out.println("Availability for " + attendees.get(attendeeIndex));
    if (attendeeAvailability.getErrorCode() == ServiceError.NoError) {
        for (CalendarEvent calendarEvent : attendeeAvailability.getCalendarEvents()) {
            System.out.println("Calendar event");
            System.out.println("  Start time: " + calendarEvent.getStartTime().toString());
            System.out.println("  End time: " + calendarEvent.getEndTime().toString());

            if (calendarEvent.getDetails() != null)
            {
                System.out.println("  Subject: " + calendarEvent.getDetails().getSubject());
                // Output additional properties.
            }
        }
    }

    attendeeIndex++;
}


// Output suggested meeting times.
for (Suggestion suggestion : results.getSuggestions()) {
    System.out.println("Suggested day: " + suggestion.getDate().toString());
    System.out.println("Overall quality of the suggested day: " + suggestion.getQuality().toString());

    for (TimeSuggestion timeSuggestion : suggestion.getTimeSuggestions()) {
        System.out.println("  Suggested time: " + timeSuggestion.getMeetingTime().toString());
        System.out.println("  Suggested time quality: " + timeSuggestion.getQuality().toString());
        // Output additonal properties.
    }
}

error:

Proxy web request failed. , inner exception: System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.RestService.EndGetSchedule(IAsyncResult asyncResult)
   at Microsoft.Exchange.InfoWorker.Common.Availability.FreeBusyApplication.EndRestProxyWebRequest(RestProxyWebRequest proxyWebRequest, QueryList queryList, RestService service, IAsyncResult asyncResult)
   at Microsoft.Exchange.InfoWorker.Common.Availability.RestProxyWebRequest.EndInvoke(IAsyncResult asyncResult)
   at Microsoft.Exchange.InfoWorker.Common.Availability.AsyncWebRequest.EndInvokeWithErrorHandling()

Hope to be able to check the user's busy schedule

0

There are 0 best solutions below