|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Invité régulier
![]() Inscription : avril 2007 Messages : 11 ![]() |
Bonjour,
J'ai modifier un code standard trouvé sur le net qui permet de créer un rendez-vous sur un serveur exchange. Le hic est que quand je donne l'heure locale à mon code, ex : 8h, le rendez-vous est inscrit pour 10h. Conclusion, il prend l'heure que je lui donne comme un format UTC, alors que c'est l'heure locale. Et ce bien que j'utilise la ligne "<cal:timezoneid dt:dt=""int"">4</cal:timezoneid>". Faut-il faire quelque chose d'autre qu'écrire cette ligne? où est-ce que je commet une erreur? merci d'avance PS : à tout hasard, voici mon code : Option Explicit CreateAppointment Private Sub CreateAppointment() 'On Error GoTo ErrHandler ' Variables Dim strApptURL 'As String Dim strExchSvrName 'As String Dim strMailbox 'As String Dim strApptItem 'As String Dim strUserName 'As String Dim strPassWord 'As String Dim strApptRequest 'As String Dim strCalInfo 'As String Dim strHeaderInfo 'As String Dim strMailInfo 'As String Dim strXMLNSInfo 'As String Dim Appt_subject 'As String Dim Appt_StartDate 'As String Dim Appt_EndDate 'As String ' Use MSXML 4.0 Dim xmlReq 'As MSXML2.XMLHTTP40 strExchSvrName = "ExchangeServer" ' Exchange server name. strMailbox = "user" ' Mailbox folder name. strApptItem = "testappointment.eml" ' Appointment item. strUserName = "Domain\user" ' Username and password of appointment creator. strPassWord = "!Password" Appt_subject = "subject of appointment" Appt_StartDate = "2007-10-23T10:00:00.000Z" Appt_EndDate = "2007-10-23T11:00:00.000Z" ' URL of the appointment item. strApptURL = "http://" & strExchSvrName & "/exchange/" & _ strMailbox & "/Calendrier/" & strApptItem ' XML namespace info of the WebDAV request. strXMLNSInfo = "xmlns:g=""DAV:"" " & _ "xmlns:e=""http://schemas.microsoft.com/exchange/"" " & _ "xmlns:mapi=""http://schemas.microsoft.com/mapi/"" " & _ "xmlns:mapit=""http://schemas.microsoft.com/mapi/proptag/"" " & _ "xmlns:x=""xml:"" xmlns:cal=""urn:schemas:calendar:"" " & _ "xmlns:dt=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" " & _ "xmlns:header=""urn:schemas:mailheader:"" " & _ "xmlns:mail=""urn:schemas:httpmail:"" " & _ "xmlns:c=""urn:schemas:calendar:timezoneid"" " & _ "xmlns:C=""urn:ietf:params:xml:ns:caldav"">" 'original strCalInfo = "<cal:location>meetappt Location</cal:location>" & _ "<cal:dtstart dt:dt=""dateTime.tz"">" & Appt_StartDate & "</cal:dtstart>" & _ "<cal:dtend dt:dt=""dateTime.tz"">" & Appt_EndDate & "</cal:dtend>" & _ "<cal:timezoneid dt:dt=""int"">4</cal:timezoneid>" & _ "<cal:instancetype dt:dt=""int"">0</cal:instancetype>" & _ "<cal:busystatus>BUSY</cal:busystatus>" & _ "<cal:meetingstatus>CONFIRMED</cal:meetingstatus>" & _ "<cal:alldayevent dt:dt=""boolean"">0</cal:alldayevent>" & _ "<cal:responserequested dt:dt=""boolean"">1</cal:responserequested>" & _ "<cal:reminderoffset dt:dt=""int"">900</cal:reminderoffset>" ' Set the required attendee of the appointment. strHeaderInfo = "<header:to>" & strMailbox & "</header:to>" ' Set the subject of the appointment. strMailInfo = "<mail:subject>" & Appt_Subject & "</mail:subject>" & _ "<mail:htmldescription>Appt_HtmlDescription</mail:htmldescription>" ' Build the XML body of the PROPPATCH request. strApptRequest = "<?xml version=""1.0""?>" & _ "<g:propertyupdate " & strXMLNSInfo & _ "<g:set><g:prop>" & _ "<g:contentclass>urn:content-classes:appointment</g:contentclass>" & _ "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>" & _ strMailInfo & _ strCalInfo & _ strHeaderInfo & _ "<mapi:finvited dt:dt=""boolean"">1</mapi:finvited>" & _ "</g:prop></g:set>" & _ "</g:propertyupdate>" ' Create the DAV PROPPATCH request. Set xmlReq = CreateObject("Microsoft.XMLHTTP") xmlReq.open "PROPPATCH", strApptURL, False, strUserName, strPassWord xmlReq.setRequestHeader "Content-Type", "text/xml" xmlReq.send strApptRequest ' The PROPPATCH request was successful. If (xmlReq.Status >= 200 And xmlReq.Status < 300) Then MsgBox "Appointment created successfully." ' Display error info. Else MsgBox "PROPPATCH status: " & xmlReq.Status & vbCrLf & _ "Status text: " & xmlReq.statusText End If ' Clean up. Set xmlReq = Nothing Exit Sub ' Implement custom error handling here. ErrHandler: ' Display error info. MsgBox "Error creating appointment/meeting: " & Err.Number & ": " & Err.Description ' Clean up. Set xmlReq = Nothing End Sub |
|
|
00
|
Copyright © 2000-2012 - www.developpez.com