phpSPO
phpSPO copied to clipboard
Create Event With specific start and end times
I am able to create calendar events without specifying a start or end time, however I am having difficulty setting these times manually.
When attempting to create an event with a start/end structure similar to the examples here: https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#CreateEvents
I receive one of the following two errors:
- An unexpected 'StartArray' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.
- An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.
Inferring from this, I attempted to create an event with a simple string, like '2017-07-18T22:00:00Z' but receive this error message:
- At least one property failed validation.
Is the DateTimeTimeZone class implemented for use, or is there another way that I should be structuring these start/end dates for event creation?
Got this working by making the following modification:
In src/OutlookServices/Event.php: - Add attribute $End to Event Class: public $End;
An event can then be created by setting the Start and End attributes with the following date/time syntax: - new_event->Start = "2017-07-19T15:31:00Z"; - new_event->End = "2017-07-19T16:31:00Z";
Could you possibly share any of the code you're using to create events? I'm trying to test this functionality, but haven't gotten it working.