Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
- xmlhttp.open "POST", "https://www.google.com/accounts/ClientLogin", false
- xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- xmlhttp.send "accountType=HOSTED_OR_GOOGLE&Email=monadresse@gmail.com&Passwd=monmotdepasse" _
- & "&source=Gulp-CalGulp-1.05&service=cl"
- lines = Split(xmlhttp.responseText, vbLf)
- nvp = Split(lines(2), "=")
- set xmlhttp = Nothing
- heurealert = DateAdd("n", 2, Now)
- heuredebut = DateAdd("n", 10, heurealert)
- heurefin = DateAdd("n", 30, heuredebut)
- starttime = Year(heuredebut) & "-" & String(2-Len(Month(heuredebut)),"0") & Month(heuredebut)_
- & "-" & String(2-Len(day(heuredebut)),"0") & day(heuredebut)_
- & "T" & String(2-Len(Hour(heuredebut)),"0") & Hour(heuredebut)_
- & ":" & String(2-Len(Minute(heuredebut)),"0") & Minute(heuredebut)_
- & ":" & String(2-Len(second(heuredebut)),"0") & second(heuredebut)
- alerttime = Year(heurealert) & "-" & String(2-Len(Month(heurealert)),"0") & Month(heurealert)_
- & "-" & String(2-Len(day(heurealert)),"0") & day(heurealert)_
- & "T" & String(2-Len(Hour(heurealert)),"0") & Hour(heurealert)_
- & ":" & String(2-Len(Minute(heurealert)),"0") & Minute(heurealert)_
- & ":" & String(2-Len(second(heurealert)),"0") & second(heurealert)
- endtime = Year(heurefin) & "-" & String(2-Len(Month(heurefin)),"0") & Month(heurefin)_
- & "-" & String(2-Len(day(heurefin)),"0") & day(heurefin)_
- & "T" & String(2-Len(Hour(heurefin)),"0") & Hour(heurefin)_
- & ":" & String(2-Len(Minute(heurefin)),"0") & Minute(heurefin)_
- & ":" & String(2-Len(second(heurefin)),"0") & second(heurefin)
- sujet = "test envoi auto"
- contenu = "serveur dans les choux"
- lieu = "ben dans la salle serveur..."
- calentry = "<?xml version='1.0' ?><entry xmlns='http://www.w3.org/2005/Atom' " _
- & "xmlns:gd='http://schemas.google.com/g/2005'>" _
- & "<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/>" _
- & "<title type='text'>" & sujet & "</title>" _
- & "<content type='text'>" & contenu & "</content>" _
- & "<gd:transparency value='http://schemas.google.com/g/2005#event.opaque'/>" _
- & "<gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'/>"_
- & "<gd:where valueString='" & lieu & "'/>" _
- & "<gd:when startTime='" & starttime & ".000+02:00' endTime='" & endtime & ".000+02:00'>"_
- & "<gd:reminder absoluteTime='" & alerttime & "+01:45' method='alert'/>" _
- & "</gd:when></entry>"
- url = "http://www.google.com/calendar/feeds/default/private/full"
- postEntry(url)
- function postEntry(url)
- set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
- xmlhttp.open "POST", url, FALSE
- xmlhttp.setRequestHeader "Content-type", "application/atom+xml"
- xmlhttp.setRequestHeader "X-If-No-Redirect", "True"
- xmlhttp.setRequestHeader "Authorization", "GoogleLogin auth=" & nvp(1)
- xmlhttp.send calentry
- testUrl = InStr(url,"?gsessionid")
- if testUrl=0 then
- redirect = xmlhttp.getResponseHeader("X-Redirect-Location")
- postEntry(redirect)
- end if
- set xmlhttp = nothing
- end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement