Comments (5)
Huh, weird. Can you show me your code where you try do do the tdwo syncs with different SyncStates?
from php-ews.
This is how I use listChanges with sync state:
$api = API::withUsernameAndPassword($server, $user, $pass, $options);
$calendar = $api->getCalendar();
$changes = $calendar->listChanges();
$syncState = $changes->getSyncState();
//first call of listChanges() with syncState
$changesSinceLastCheck = $calendar->listChanges($syncState);
$syncState2 = $changesSinceLastCheck->getSyncState();
//second call of listChanges() with syncState
$changesSinceLastCheck2 = $calendar->listChanges($syncState2);
$createdElements = $changesSinceLastCheck->getChanges()->getCreate();
$createdElements2 = $changesSinceLastCheck->getChanges()->getCreate();
//dump subject texts for elements listed by first call
foreach ($createdElements as $element) {
$elementWithBody = $calendar->getCalendarItem($element->getCalendarItem()->getItemId()->getId(), $element->getCalendarItem()->getItemId()->getChangeKey());
var_dump($elementWithBody->getSubject());
}
//dump subject texts for elements listed by second call
foreach ($createdElements2 as $element) {
$elementWithBody = $calendar->getCalendarItem($element->getCalendarItem()->getItemId()->getId(), $element->getCalendarItem()->getItemId()->getChangeKey());
var_dump($elementWithBody->getSubject());
}
from php-ews.
Just to double check, is that what you've got in your source code? Because
$createdElements = $changesSinceLastCheck->getChanges()->getCreate();
$createdElements2 = $changesSinceLastCheck->getChanges()->getCreate();
are both reading from the same $changesSinceLastCheck
, when $createdElements2
should be reading from $changesSinceLastCheck2
instead.
Also, a tip: If you already have the completed itemId (like from getItemId()), you can bypass the getCalendarItem() function for more readability. For example
$elementWithBody = $calendar->getItem($element->getCalendarItem()->getItemId());
Also, maybe it would be a good idea to dump the ItemId of the elements instead of the subject? That way you have a better way to see if they're the same item or just two items with the same subject?
from php-ews.
Thank you! It works now, changing the second $changesSinceLastCheck
to $changesSinceLastCheck2
, my dumb mistake.
from php-ews.
No problem :) I'm glad it worked for you. I don't use that function, so I didn't know if there was a bug or not. I realized that I didn't unit test fetching changes when you pass in an existing syncState, so I'm writing those tests now.
from php-ews.
Related Issues (20)
- getDatetime does not return \Datetime for MessageType instance
- how to fetch __getLastResponse, __getLastResponseHeaders,....
- Submitting GetUserOofSettings and SetUserOofSettings request
- Getting recurrence data HOT 1
- Is it possible to get user's Authorization Codes for OAuth, directly from Azure AD and without a web browser redirect? HOT 5
- GetUserOofSettings Request HOT 1
- Creating a new email with .eml attachment
- Authorization stopped working suddenly HOT 1
- looks like we got no XML document
- Upgrade from jamesiarmes -> garethp php-ews HOT 1
- Create a contact
- internetMessageHeaders HOT 1
- BUG FreeBusyResponse array HOT 1
- toRecipients getting null values for inplace archive mails
- Update Mail Item -> Categorize Email HOT 1
- PHP 8.2 - Deprecated dynamic properties HOT 5
- Oauth is not working with Exchange 2013
- Issue with using toRecipients property in EWS restriction HOT 2
- Daylight Savings
- How to get medias appointment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-ews.