Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching calendar items not implemented? #17

Closed
AlexSugak opened this issue Mar 29, 2016 · 8 comments
Closed

Fetching calendar items not implemented? #17

AlexSugak opened this issue Mar 29, 2016 · 8 comments
Assignees

Comments

@AlexSugak
Copy link

Hello,

I am trying to fetch calendar appointments using FindAppointments (or FindItems) method.
It looks like CalendarView has no implementations for required xml serialization methods yet, so this doesn't work.

Is there another way to search for meetings by date range?
If not, could you please give a hint on proper implementation of CalendarView's required methods (I am new to TypeScript and EWS)?

@gautamsi
Copy link
Owner

let me work on this later this week. probably over weekend.

if you just want availability, you can try GetUserAvailability of ExchangeService object.

@gautamsi
Copy link
Owner

gautamsi commented Apr 3, 2016

I have published a release on GitHub (not npm) https://github.com/gautamsi/ews-javascript-api/releases/tag/test-0.2.3-pre

Get latest pre-release and you can install tgz file in npm.

let me know if this helps. Have only tested by running ExchangeService.FindAppointments, not tried loading appointment body, should work though.

@AlexSugak
Copy link
Author

Thank you!

Having troubles making it work in browser though.
I see that XHR API is hardcoded to WinJS.xhr right now.
Does this mean that ews api only supports node and browser is not supported?

Will try running from node.

@gautamsi
Copy link
Owner

gautamsi commented Apr 4, 2016

I can give you build for browser, it is not going to help. Exchange EWS does not support HTTP OPTIONS verb, this means browser xhr is going to fail due to pre call.

only way you can test is to run Google Chrome with unsafe (CORS disabled chromium-browser --disable-web-security. You can not deploy it anywhere.

you can sure swap out WinJS.XHR with your own library, just create a shim module with xhr(xhroptions) method returning a Promise. An example on how to create custom XHR.

XHRFactory_WinJS.ts file can also give you information on how to implement simpler shim.

@AlexSugak
Copy link
Author

Aha, I see.
Made it work under node. Had to use HTLM from your gist.
Thanks a lot!

@gautamsi gautamsi closed this as completed Apr 5, 2016
@gautamsi gautamsi added done and removed in-progress labels Apr 5, 2016
@jsinai
Copy link

jsinai commented Nov 16, 2016

Hi, I am trying to do the same thing, using the npm module, and the tar file mentioned above. I have tried both ExchangeService.FindAppointments and the CalendarFolder. Neither works for me. I really could use a hint. I apologize, I am new to EWS. Note, my Exchange server is 2010.

Here is my test script:

var ews = require('ews-javascript-api');
var exch = new ews.ExchangeService(ews.ExchangeVersion.Exchange2010);
exch.Credentials = new ews.ExchangeCredentials("email", "pwd");
exch.Url = new ews.Uri("https://host/ews/Exchange.asmx");
var cv = new ews.CalendarView();
cv.StartDate = new Date("11/14/16");
cv.EndDate = new Date("11/25/16");
exch.FindAppointments(ews.WellKnownFolderName.Calendar, cv).then(function (appts) {
    appts.each(function(appt){console.log(appt);})
});

Here is the version that binds to CalendarFolder:

ews.CalendarFolder.Bind(exch, id).then(function (service) {
    service.FindAppointments(cv).then(function (appts) {appts.each(function(appt){console.log(appt);})});
});

@jsinai
Copy link

jsinai commented Nov 16, 2016

Never mind, I found one answer here:

#68

@gautamsi
Copy link
Owner

@AlexSugak see #190 if you want browser based script, still have to use webpack like optimizer. CORS is still the issue. but you can run in Electron/Nwjs renderer process (webview)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants