2012-06-27 43 views
0

如何使用PHP代碼爲Office 365中的用戶日曆創建/更新約會?我看到的只是一個託管代碼API。是否有一個Web服務/ REST API可以在PHP中使用?如何從PHP代碼創建/更新約會Office365?

基本上我試圖創建/更新基於用PHP編寫的本地系統登錄的Office 365用戶的約會。

或者這是否需要使用WebDAV來完成,如果有的話,任何PHP的建議呢?

回答

0

這對PHP方面沒有幫助,但是這裏是鏈接到the documentation for the Managed API。它顯示了發送到服務器的示例SOAP XML。我不確定你將如何通過PHP進行身份驗證。希望這會有所幫助(或者你找到了另一種方法)。

創建約會

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Header> 
     <t:RequestServerVersion Version="Exchange2010" /> 
    </soap:Header> 
    <soap:Body> 
     <m:CreateItem SendMeetingInvitations="SendToNone"> 
     <m:Items> 
      <t:CalendarItem> 
       <t:Subject>Dentist Appointment</t:Subject> 
       <t:Body BodyType="Text">The appointment is with Dr. Smith.</t:Body> 
       <t:Start>2009-03-02T17:00:00Z</t:Start> 
       <t:End>2009-03-02T19:00:00Z</t:End> 
      </t:CalendarItem> 
     </m:Items> 
     </m:CreateItem> 
    </soap:Body> 
</soap:Envelope> 

更新預約

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Header> 
     <t:RequestServerVersion Version="Exchange2010" /> 
    </soap:Header> 
    <soap:Body> 
     <m:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToAllAndSaveCopy"> 
     <m:ItemChanges> 
      <t:ItemChange> 
       <t:ItemId Id="AAMkA=" ChangeKey="DwAAA" /> 
        <t:Updates> 
        <t:SetItemField> 
         <t:FieldURI FieldURI="item:Subject" /> 
         <t:CalendarItem> 
          <t:Subject>Status Meeting - Rescheduled/Moved</t:Subject> 
         </t:CalendarItem> 
        </t:SetItemField> 
        <t:SetItemField> 
         <t:FieldURI FieldURI="calendar:Location" /> 
         <t:CalendarItem> 
          <t:Location>Conf Room 34</t:Location> 
         </t:CalendarItem> 
        </t:SetItemField> 
        <t:SetItemField> 
         <t:FieldURI FieldURI="calendar:Start" /> 
         <t:CalendarItem> 
         <t:Start>2009-03-05T17:00:00Z</t:Start> 
         </t:CalendarItem> 
        </t:SetItemField> 
        <t:SetItemField> 
         <t:FieldURI FieldURI="calendar:End" /> 
         <t:CalendarItem> 
         <t:End>2009-03-05T18:00:00Z</t:End> 
         </t:CalendarItem> 
        </t:SetItemField> 
        <t:SetItemField> 
         <t:FieldURI FieldURI="calendar:RequiredAttendees" /> 
         <t:CalendarItem> 
         <t:RequiredAttendees> 
          <t:Attendee> 
           <t:Mailbox> 
           <t:Name>[email protected]</t:Name> 
           <t:EmailAddress>[email protected]</t:EmailAddress> 
           <t:RoutingType>SMTP</t:RoutingType> 
           </t:Mailbox> 
          </t:Attendee> 
          <t:Attendee> 
           <t:Mailbox> 
           <t:EmailAddress>[email protected]</t:EmailAddress> 
           </t:Mailbox> 
          </t:Attendee> 
         </t:RequiredAttendees> 
        </t:CalendarItem> 
        </t:SetItemField> 
       </t:Updates> 
      </t:ItemChange> 
     </m:ItemChanges> 
     </m:UpdateItem> 
    </soap:Body> 
</soap:Envelope>