{"action":"created","issue":{"url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/272","labels_url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/272/comments","events_url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/272/events","html_url":"https://github.com/jamesiarmes/php-ews/issues/272","id":75777831,"number":272,"title":"Object of class EWSType_OccurrenceType could not be converted to int in NTLMSoapClient_Exchange->CreateItem() (line 331 of C:\\wamp\\www\\sites\\all\\libraries\\php-ews\\ExchangeWebServices.php).","user":{"login":"heiangus","id":12419731,"avatar_url":"https://avatars.githubusercontent.com/u/12419731?v=3","gravatar_id":"","url":"https://api.github.com/users/heiangus","html_url":"https://github.com/heiangus","followers_url":"https://api.github.com/users/heiangus/followers","following_url":"https://api.github.com/users/heiangus/following{/other_user}","gists_url":"https://api.github.com/users/heiangus/gists{/gist_id}","starred_url":"https://api.github.com/users/heiangus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heiangus/subscriptions","organizations_url":"https://api.github.com/users/heiangus/orgs","repos_url":"https://api.github.com/users/heiangus/repos","events_url":"https://api.github.com/users/heiangus/events{/privacy}","received_events_url":"https://api.github.com/users/heiangus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-12T23:30:14Z","updated_at":"2015-05-13T16:36:35Z","closed_at":null,"body":"My code which follows, Creates my calendar entry in a Microsoft Exchange Server 2010 public folder perfectly. However it gives the error above during the process!\r\nCan you tell me why and how to fix?\r\n\r\n\t\t\t$request = new EWSType_CreateItemType();\r\n\t\t\t$request->SavedItemFolderId->FolderId->Id=$exchcal->exch_folder_id;\r\n\r\n\t\t\t$request->Items = new EWSType_NonEmptyArrayOfAllItemsType();\r\n\t\t\t$request->Items->CalendarItem = new EWSType_CalendarItemType();\r\n\r\n\t\t\t// Set the subject.\r\n\t\t\t$request->Items->CalendarItem->Subject = $rev_node->title;\r\n\t\t\t$request->Items->CalendarItem->Location = $rev_node->field_location[$node->language][0]['safe_value'];\r\n \t\t\t\r\n\t\t\t// Set the start and end times. For Exchange 2007, you need to include the timezone offset.\r\n\t\t\t// For Exchange 2010, you should set the StartTimeZone and EndTimeZone properties. See below for\r\n\t\t\t// an example.\r\n\t\t\t$start_time = date('Y-m-d\\TH:i:s', strtotime($rev_node->field_time[$node->language][0]['value']));\r\n\t\t\t$end_time = date('Y-m-d\\TH:i:s', strtotime($rev_node->field_time[$node->language][0]['value2']));\r\n\t\t\t\r\n\t\t\t$request->Items->CalendarItem->Start = $start_time;\r\n\t\t\t$request->Items->CalendarItem->End = $end_time;\r\n\t\t\t\r\n\t\t\techo $start_time.\" - \".$end_time.\"<br>\";\r\n\t\t\t\r\n\t\t\t// Build the timezone definition and set it as the StartTimeZone.\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone = new EWSType_TimeZoneDefinitionType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Id = 'Pacific Standard Time';\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Periods = new EWSType_NonEmptyArrayOfPeriodsType();\r\n\t\t\t\r\n\t\t\t$period = new EWSType_PeriodType();\r\n\t\t\t$period->Bias =  'PT8H';\r\n\t\t\t$period->Name = 'Standard';\r\n\t\t\t$period->Id = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Standard';\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Periods->Period[] = $period;\r\n\t\t\t\r\n\t\t\t$period = new EWSType_PeriodType();\r\n\t\t\t$period->Bias =  'PT7H';\r\n\t\t\t$period->Name = 'Daylight';\r\n\t\t\t$period->Id = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Daylight';\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Periods->Period[] = $period;\r\n\t\t\t\r\n\t\t\t$period = new EWSType_PeriodType();\r\n\t\t\t$period->Bias =  'PT8H';\r\n\t\t\t$period->Name = 'Standard';\r\n\t\t\t$period->Id = 'trule:Microsoft/Registry/Pacific Standard Time/2007-Standard';\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Periods->Period[] = $period;\r\n\t\t\t\r\n\t\t\t$period = new EWSType_PeriodType();\r\n\t\t\t$period->Bias =  'PT7H';\r\n\t\t\t$period->Name = 'Daylight';\r\n\t\t\t$period->Id = 'trule:Microsoft/Registry/Pacific Standard Time/2007-Daylight';\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Periods->Period[] = $period;\r\n\t\t\t\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->TransitionsGroups = new EWSType_ArrayOfTransitionsGroupsType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->TransitionsGroups->TransitionsGroup = array();\r\n\t\t\t\r\n\t\t\t$group = new EWSType_ArrayOfTransitionsGroupsType();\r\n\t\t\t$group->Id = 0;\r\n\t\t\t\r\n\t\t\t$transition = new EWSType_RecurringDayTransitionType();\r\n\t\t\t$transition->To = new EWSType_TransitionTargetType();\r\n\t\t\t$transition->To->_ = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Daylight';\r\n\t\t\t$transition->To->Kind = new EWSType_KindType();\r\n\t\t\t$transition->To->Kind->_ = EWSType_KindType::PERIOD;\r\n\t\t\t$transition->TimeOffset = 'PT2H';\r\n\t\t\t$transition->Month = 4;\r\n\t\t\t$transition->Occurrence = new EWSType_OccurrenceType();\r\n\t\t\t$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_BEGINNING;\r\n\t\t\t$transition->DayOfWeek = new EWSType_DayOfWeekType();\r\n\t\t\t$transition->DayOfWeek->_ = EWSType_DayOfWeekType::SUNDAY;\r\n\t\t\t$group->RecurringDayTransition[] = $transition;\r\n\t\t\t\r\n\t\t\t$transition = new EWSType_RecurringDayTransitionType();\r\n\t\t\t$transition->To = new EWSType_TransitionTargetType();\r\n\t\t\t$transition->To->_ = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Standard';\r\n\t\t\t$transition->To->Kind = new EWSType_KindType();\r\n\t\t\t$transition->To->Kind->_ = EWSType_KindType::PERIOD;\r\n\t\t\t$transition->TimeOffset = 'PT2H';\r\n\t\t\t$transition->Month = 10;\r\n\t\t\t$transition->Occurrence = new EWSType_OccurrenceType();\r\n\t\t\t$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_END;\r\n\t\t\t$transition->DayOfWeek = new EWSType_DayOfWeekType();\r\n\t\t\t$transition->DayOfWeek->_ = EWSType_DayOfWeekType::SUNDAY;\r\n\t\t\t$group->RecurringDayTransition[] = $transition;\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->TransitionsGroups->TransitionsGroup[] = $group;\r\n\t\t\t\r\n\t\t\t$group = new EWSType_ArrayOfTransitionsGroupsType();\r\n\t\t\t$group->Id = 1;\r\n\t\t\t\r\n\t\t\t$transition = new EWSType_RecurringDayTransitionType();\r\n\t\t\t$transition->To = new EWSType_TransitionTargetType();\r\n\t\t\t$transition->To->_ = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Daylight';\r\n\t\t\t$transition->To->Kind = new EWSType_KindType();\r\n\t\t\t$transition->To->Kind->_ = EWSType_KindType::PERIOD;\r\n\t\t\t$transition->TimeOffset = 'PT2H';\r\n\t\t\t$transition->Month = 3;\r\n\t\t\t$transition->Occurrence = new EWSType_OccurrenceType();\r\n\t\t\t$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_BEGINNING;\r\n\t\t\t$transition->DayOfWeek = new EWSType_DayOfWeekType();\r\n\t\t\t$transition->DayOfWeek->_ = EWSType_DayOfWeekType::SUNDAY;\r\n\t\t\t$group->RecurringDayTransition[] = $transition;\r\n\t\t\t\r\n\t\t\t$transition = new EWSType_RecurringDayTransitionType();\r\n\t\t\t$transition->To = new EWSType_TransitionTargetType();\r\n\t\t\t$transition->To->_ = 'trule:Microsoft/Registry/Pacific Standard Time/2006-Standard';\r\n\t\t\t$transition->To->Kind = new EWSType_KindType();\r\n\t\t\t$transition->To->Kind->_ = EWSType_KindType::PERIOD;\r\n\t\t\t$transition->TimeOffset = 'PT2H';\r\n\t\t\t$transition->Month = 11;\r\n\t\t\t$transition->Occurrence = new EWSType_OccurrenceType();\r\n\t\t\t$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_END;\r\n\t\t\t$transition->DayOfWeek = new EWSType_DayOfWeekType();\r\n\t\t\t$transition->DayOfWeek->_ = EWSType_DayOfWeekType::SUNDAY;\r\n\t\t\t$group->RecurringDayTransition[] = $transition;\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->TransitionsGroups->TransitionsGroup[] = $group;\r\n\t\t\t\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions = new EWSType_ArrayOfTransitionsType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions->Transition = new EWSType_TransitionType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions->Transition->To = new EWSType_TransitionTargetType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions->Transition->To->_ = 0;\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions->Transition->To->Kind = new EWSType_KindType();\r\n\t\t\t$request->Items->CalendarItem->StartTimeZone->Transitions->Transition->To->Kind = EWSType_KindType::GROUP;\r\n\t\t\t\r\n\t\t\t// The EndTimeZone is the same so just clone the StartTimeZone.\r\n\t\t\t$request->Items->CalendarItem->EndTimeZone = clone $request->Items->CalendarItem->StartTimeZone;\r\n\r\n\t\t\t// Set no reminders\r\n\t\t\t$request->Items->CalendarItem->ReminderIsSet = false;\r\n\t\t\t\r\n\t\t\t// Build the body.\r\n\t\t\t$request->Items->CalendarItem->Body = new EWSType_BodyType();\r\n\t\t\t$request->Items->CalendarItem->Body->BodyType = EWSType_BodyTypeType::HTML;\r\n\t\t\t$request->Items->CalendarItem->Body->_ = isset($node->body[$node->language][0]['safe_value']) ? $node->body[$node->language][0]['safe_value'] : '';\r\n\t\t\t\r\n\t\t\t$request->Items->CalendarItem->ItemClass = new EWSType_ItemClassType();\r\n\t\t\t$request->Items->CalendarItem->ItemClass->_ = EWSType_ItemClassType::APPOINTMENT;\r\n\t\t\t$request->Items->CalendarItem->Sensitivity = new EWSType_SensitivityChoicesType();\r\n\t\t\t$request->Items->CalendarItem->Sensitivity->_ = EWSType_SensitivityChoicesType::NORMAL;\r\n\t\t\t\r\n\t\t\t// Add some categories to the event.\r\n\t\t\t$request->Items->CalendarItem->Categories = new EWSType_ArrayOfStringsType();\r\n\t\t\t$request->Items->CalendarItem->Categories->String = array('Testing', 'php-ews');\r\n\t\t\t\r\n\t\t\t// Set the importance of the event.\r\n\t\t\t$request->Items->CalendarItem->Importance = new EWSType_ImportanceChoicesType();\r\n\t\t\t$request->Items->CalendarItem->Importance->_ = EWSType_ImportanceChoicesType::NORMAL;\r\n\t\t\t\r\n\t\t\t// Don't send meeting invitations.\r\n\t\t\t$request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE;\r\n\r\n\t\t\t$response = $ews->CreateItem($request); \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/comments/101739647","html_url":"https://github.com/jamesiarmes/php-ews/issues/272#issuecomment-101739647","issue_url":"https://api.github.com/repos/jamesiarmes/php-ews/issues/272","id":101739647,"user":{"login":"heiangus","id":12419731,"avatar_url":"https://avatars.githubusercontent.com/u/12419731?v=3","gravatar_id":"","url":"https://api.github.com/users/heiangus","html_url":"https://github.com/heiangus","followers_url":"https://api.github.com/users/heiangus/followers","following_url":"https://api.github.com/users/heiangus/following{/other_user}","gists_url":"https://api.github.com/users/heiangus/gists{/gist_id}","starred_url":"https://api.github.com/users/heiangus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heiangus/subscriptions","organizations_url":"https://api.github.com/users/heiangus/orgs","repos_url":"https://api.github.com/users/heiangus/repos","events_url":"https://api.github.com/users/heiangus/events{/privacy}","received_events_url":"https://api.github.com/users/heiangus/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T16:36:34Z","updated_at":"2015-05-13T16:36:34Z","body":"Solved:\r\nmy solution was to replace:\r\n\r\n$transition->Occurrence = new EWSType_OccurrenceType();\r\n$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_BEGINNING;\r\n\r\nwith\r\n\r\n$transition->Occurrence = 1;\r\n \r\nand \r\n\r\n$transition->Occurrence = new EWSType_OccurrenceType();\r\n$transition->Occurrence->_ = EWSType_OccurrenceType::FIRST_FROM_END;\r\n\r\nwith\r\n\r\n$transition->Occurrence = -1;"}}