X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Inserting A New Google Calendar Event Via VBA, Access 2016    
post Jan 11 2017, 07:32 PM

Posts: 359
Joined: 21-January 06

I am writing an application in MS Access 2016 and trying to add a calendar event.

I am able to connect and pull down a calendar list ok so I know I am connecting ok using the SendHTTP module.

I went to the Google API explorer and created JSON to add an event and it works in the sandbox but when I try to run in my application, I get an error code 400, domain;global; reason;required, Missing end time. I copied the JSON from the sandbox and pasted as Body in the PostEvent sub.

Here is my code:

Public Sub SendHTTP(URL As String, Optional Method As String = "POST", Optional Content As String = "text/plain", Optional Body As String = "", Optional addAuth As Boolean = False, Optional Headers As Variant)

Dim hdrLine As Variant
Dim hdrarr As Variant

Set Http = New MSXML2.XMLHTTP60

With Http
Call .Open(Method, URL)
If Content <> "" Then Call .setRequestHeader("Content-Type", Content)
If addAuth Then Call .setRequestHeader("Authorization", OAuth2.oauth2_token_type & " " & OAuth2.oauth2_access_token)
If IsArray(Headers) Then
For Each hdrLine In Headers
hdrarr = Split(CStr(hdrLine), ":")
Call .setRequestHeader(hdrarr(0), hdrarr(1))
End If
Call .send(Body)
End With

Set Http = Nothing

End Sub

Public Sub PostEvent()
Method = "POST"
URL = "https://www.googleapis.com/calendar/v3/calendars/primary/events"
Content = "json"
Body = "{""start"":{""dateTime"":""2017-01-11T14:30:00"",""timeZone"":""America/Los_Angeles""},""end"":{""dateTime"":""2017-01-11T17:30:00"",""timeZone"":""America/Los_Angeles""},""colorId"":""11"",""summary"":""Test summary"",""description"":""test desc"",""location"":""here"",}"
addAuth = True

SendHTTP URL, Method, Content, Body, addAuth
End Sub

Any help would be appreciated. Thanks.
Go to the top of the page
post Jan 11 2017, 09:10 PM

Posts: 359
Joined: 21-January 06

I was able to figure it out....

I changed:

and I also had an extra , at the end of the body line.

I plan on putting together a post that outlines exactly how to get google calendar to work with MS Access once I get everything working correctly. I have been searching and testing different methods for months and finally have a solution that works. I can't believe that no one else has experienced the issues that I have in getting this to work correctly.

Go to the top of the page
post Jan 12 2017, 04:23 AM

Posts: 295
Joined: 23-April 15
From: NY

That would be awesome if you could post how you get them up and down from access right now we are just uploading and downloading csv files.
Go to the top of the page
post Jan 12 2017, 04:28 PM

Posts: 164
Joined: 12-December 12
From: Bosna i Hercegovina

gtsolano, what about this: https://github.com/VBA-tools/VBA-JSON
Go to the top of the page
Flap Zappa
post Aug 8 2018, 01:03 PM

Posts: 7
Joined: 8-August 18

did you ever sort out the post for google calender events
Go to the top of the page
post Aug 12 2019, 02:11 PM

Posts: 1
Joined: 11-August 19

hi gtsolano

as-tu trouvé une solution à ton problème?

Je cherche moi aussi à utilise Google Agenda à partir d'ACCESS 2016

Merci pour ton retour d'information
This post has been edited by ArthurDelyon: Aug 12 2019, 02:12 PM
Go to the top of the page
post Aug 12 2019, 02:17 PM

Access Wiki and Forums Moderator
Posts: 76,290
Joined: 19-June 07
From: SunnySandyEggo

Salut Arthur. Bienvenue à l'UA! C'est un vieux fil. Je vous suggère de commencer un nouveau fil pour votre question. à votre santé!

Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
post Aug 12 2019, 02:26 PM

UtterAccess VIP
Posts: 6,831
Joined: 30-June 11


Je te suggère de regarder https://www.UtterAccess.com/forum/index.php...8&hl=google

Daniel Pineault (2010-2019 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc

All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    15th September 2019 - 03:32 PM