Well, I was trying to create an item in the calendar and I encountered with two errors:
- Missing "Subject" property for CalendarItemType
- Missing file "CalendarItemCreateOrDeleteOperationType", that has constants that define the send method policy on item creation. 2.a. Missing file "CalendarItemUpdateOperationType", that has constants that define the send method policy on item update.
I added the missing subject property and created the two files missing based on the enumeration in "types.xsd". Hope this will help.
Actual code to insert a calendar item:
$ews = new ExchangeWebServices($host, $username, $password); // start building the find request $request = new EWSType_CreateItemType(); $request->Items = new EWSType_NonEmptyArrayOfAllItemsType(); $request->Items->CalendarItem = new EWSType_CalendarItemType();
// configure the view $request->Items->CalendarItem->Subject = "Basic Calendar Item Insertion"; $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE; //$request->SendMeetingInvitationsSpecified = true; $response = $ews->CreateItem($request); echo '<pre>'.print_r($response, true).'</pre>';
- CalendarItemType.php 8.67KB
Comment #1
Posted on Feb 16, 2011 by Massive BirdDidn´t work for me! :/ I get this message:
{{{ stdClass Object ( [ResponseMessages] => stdClass Object ( [CreateItemResponseMessage] => stdClass Object ( [MessageText] => SendMeetingInvitations attribute is required for calendar items. [ResponseCode] => ErrorSendMeetingInvitationsRequired [DescriptiveLinkKey] => 0 [ResponseClass] => Error [Items] => stdClass Object ( )
)
)
) }}}
Tried to use:
{{{ https://red002.mail.emea.microsoftonline.com/EWS/Exchange.asmx }}}
Comment #2
Posted on Feb 16, 2011 by Massive BirdOk, got it working. I´ve set it to the requests item, not the request... bad. ;o)
Comment #3
Posted on Feb 16, 2011 by Helpful KangarooHi, thank you for remember me this project, I have modified the library and get it working in a production environment to create, delete, update and read items from and to the calendar. I will send it right now to James for a future release.
Comment #4
Posted on Feb 16, 2011 by Happy GiraffeThat´s really great! I love social coding, just for this. :o) You made my day. ;o) I got all working, too. (create, update, delete) But i had a lot to google, the necessary information was spread all over the web. This will definitely help a lot of people.
greetings André
Comment #5
Posted on Apr 22, 2011 by Happy GiraffeI had this problem too, this topic really helped me so thanks a lot guys! Now I can add and edit an event without problems, but only the calendar of the person logged in with. Is there a way I can add/edit the calendars of other users if I login with an admin account? If yes, how? I don't know how to get their calendars! I don't want ot have their password for each of them, so that would realy help me! Note: we don't want shared calendars, everyone has his own calendars!
Comment #6
Posted on Jan 18, 2012 by Quick RhinoGreat, that is great!!, thaks for the code. [°_°]
Comment #7
Posted on Jan 20, 2012 by Happy GiraffeHas someone a solution to nenes...es problem. I have the same issue to add entries to someone elses calendar, without knowing their passwords.
Another Question, what about the body text. I do not see a body property in EWSType_CalendarItemType.
But nevertheless, really great code. Saved me a lot of time.
Comment #8
Posted on Jan 20, 2012 by Happy GiraffeFinaly this solution didn't have the required functions I needed. So i changed my solution : I use a Web Service coded in C# (framework 4.0) with the EWS API : http://msdn.microsoft.com/en-us/library/dd633709(v=EXCHG.80).aspx What is great in this solution, is that I can impersonate the different users with only their login or email adress and then I can send mail, add meetings, events and contacts. A great API I recommand and I am now integrating it in a Silverlight application. Sorry I can't help more with this API. Then I call this web service in my PHP pages.
Comment #9
Posted on Feb 14, 2012 by Quick KangarooThis issue has been moved to GitHub https://github.com/jamesiarmes/php-ews/issues/7
Status: MovedToGitHub
Labels:
Type-Defect
Priority-Medium