EWS Java API 1.1 meeting creation - missing TimeZoneDefinition

I have Exchange Server 2007 SP1 and want to create an appointment with EWS Java API 1.1. I have an exception that I must first set the time zone definition.

    appointment.setStartTimeZone(new TimeZoneDefinition(){{
        setName( "W. Europe Standard Time" );
    }}); 

I tried installing it directly, but got this exception:

The time zone definition is invalid or unsupported

I saw some workarounds where you need to edit the Java API (for example, skip the TimeZoneDefinition check), but if possible, I don't want to make any changes there. Hope someone knows how I can set TimeZoneDefinition correctly (without changing the underlying Java API).

Edit: In .NET, it seems that you can set TimeZoneDefinition directly like this:

appointment.StartTimeZone = TimeZoneInfo.Local;

But I can not find anything like this in the Java API

+3
1

- ( java ews api), StartTimeZone Exchange 2007 1 (SP1) - Spring .

: , Exchange 2007 SP1 StartTimeZone EWS. , Exchange 2010. , "" Java Exchange Framework.

, , , .NET, :

Nancy.

.

NancyModule:

namespace WebServiceNancy
{
public class APIModul : NancyModule
{
    public APIModul() : base("/")
    {

        Post["/saveFooApp"] = _ =>
        {   
            var jsonApp = this.Bind<AppData>();
            string ewsURL = "https://saveFooApp/ews/exchange.asmx";
            System.Uri ewsUri = new System.Uri(ewsURL);

            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
            service.Url = ewsUri;

            service.Credentials = new WebCredentials(jsonApp.Username, jsonApp.Password);

            Appointment app = new Appointment(service);
            app.Subject = jsonApp.Title;
            app.Start = jsonApp.Start;
            app.End = jsonApp.End;

            app.Save(WellKnownFolderName.Calendar);

            return Response.AsText("OK").WithStatusCode(HttpStatusCode.OK);
        };
    }
}


public class AppData
{
    public string Title { get; set; }
    public DateTime Start { get; set; }
    public DateTime End { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
}
}

WS Spring, json- RestTemplate:

SimpleDateFormat formatter = new  SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startDate = formatter.format(fooMeeting.getMeetingStart());
String endDate = formatter.format(fooMeeting.getMeetingEnd());

JSONObject obj = new JSONObject();
obj.put("title", fooMeeting.getTitle());
obj.put("start", startDate);
obj.put("end", endDate);
obj.put("username", fooUser.getUsername());                 
obj.put("password", fooUser.getPassword());

RestTemplate rt = new RestTemplate();

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

JSONSerializer jsonSer = new JSONSerializer();

HttpEntity<String> entity = new HttpEntity<String>(jsonSer.serialize(obj), headers);

ResponseEntity<String> response = rt.exchange("http://localhost:8282/saveFooApp", HttpMethod.POST, entity, String.class);               
System.out.println(response.getStatusCode());

, - .

  • EWS.

0

All Articles