Salesforce – Google Calendar Integration tips and tricks

Hello friends, In this post, I will show you how you can integrate Salesforce with Google Calendar so that Salesforce user could aware of all upcoming events and tasks!

Below is the list of all the tasks that we will do in this post to do Integrate Google Calendar with Salesforce.

  1. Create a public List type Custom SettingGoogleCalenderInfo” to store the access/refresh token and expiry time (in Seconds).
  2. Enable Google Calendar API and create an App to get the Consumer Key and Consumer Secret
  3. Create VF page Apex Class to make the callout and store Access/Refresh Token into Custom Setting.
  4. Create Another VF page which will fetch all the List of Calendar Available into your Calendar and create a new Calendar From Salesforce.

Create New Custom Setting: –

Login into Your Salesforce Org and go to Setup -> Develop -> Custom Settings -> New

See below image for the field names and data types

Custom Setting

Create Required VF pages and Apex Classes: –

  • Open Developer Console and Create 2 Apex Classes GoogleCalenderApi and GoogleCalendarActionsController.
  • Now, Create 2 VF pages “GoogleCalendarActions” and “GoogleCalenderoAuth”
  • You will get the Complete code for All the pages and Apec Classes From Here copy the code and paste in your pages/classes.

Do Enable Google Calendar API and Settings: –

Go to  Using OAuth 2.0 to Access Google APIs and you will get Detailed Information about authentication process.

Go to Google API Console, Credentials -> Create Credentials -> oAuth Client Id

1

Application Type -> WEB

Authorized redirect URIs -> URL To Your VF page “You already have created the VF page if not follow the above steps and create both the pages with classes”

Open “GoogleCalenderoAuth” VF page, Click Preview and Copy the URL that URL is the Redirect URI paste that URL here.

Note: – You also need to replace “redirect_uri” variable in GoogleCalendarAPI class with your VF page URL. 

VF PAGE Preview.png

Now, Click Create, a Pop up with Client Id and Client Secret will open

2

3

Copy both Client Id and Client Secret in any text Editor like notepad++, notepad, or any editor.

Now, Open GoogleCalenderApi class replace consumerKey with your Client Id and clientSecret with your Client Secret.

Now, as we have done all the necessary steps and it’s show time.

Open “GoogleCalenderoAuth” VF page, preview it Page will look like below

VF page.png

Click “Connect With Calendar” you will be redirected to Gmail Login, Login with your Gmail, Grant Access to Application. You will get back to the same Page and Now Click “Get Access Token” a new Page “GoogleCalendarActions” will open.

VF page.png

VF page

First, we will create a New Calendar, Enter “Testing Google API ” and then Create New Calendar. You will get a Success Message with the response.

Create New Calendar

Now, List All Calendars will list all the calendars that are available to your Account.

List All Calendars.png

Note: – Using the Above Code of “GoogleCalenderoAuth” Page and “GoogleCalenderApi” Apex Class you can integrate with Any Google API. You only need to make a minor change which is the value of the calendar_Scope variable in GoogleCalenderApi class, use the scope of the API that you want to Connect. You will get the scope of all the APIs OAuth 2.0 Scopes for Google APIs.

Any Queries come in the comment section.

 

40 thoughts on “Salesforce – Google Calendar Integration tips and tricks

  1. Srujan April 29, 2020 / 1:59 pm

    Hi amit could you post the vf page code as well please thank you.

    Like

  2. Chandresh Gupta November 13, 2018 / 9:25 am

    Hi Amit,

    Can you please tell me how to add event dynamically based on your given code.

    Like

      • Abhishek January 2, 2020 / 7:02 am

        Any updates regarding this query?It will be of a great help!

        Like

      • Amit Singh January 5, 2020 / 11:40 am

        Hey, Which query you are referring ?

        Like

  3. Josh Long November 6, 2018 / 9:35 pm

    Sorry, but now that I have more of this setup I was wondering if you found the format for sending multiple events to the google calendar in one call?

    Like

    • Josh Long November 8, 2018 / 1:15 am

      Found this with the use of Batch calling. (Sorry to be blowing up the blog comments.)

      My last issue pertains to Events and their Start/End Times when syncing them one way or the other. I seem to not be able to get them to create in the other place for the same time.

      I know I must have to do something with the usage of timezones but not sure exactly the best way to handle.. Currently both the SF and Google side are in the same time zone but when parsing the data from or to I must not be doing something quite right..

      I was hoping you or someone else may have a good example for this?

      Like

  4. Josh Long November 6, 2018 / 8:20 pm

    Hey Amit,

    I am trying to implement this but keep hitting Status Forbidden and Code 403
    is there a step I am missing to give access? (I can’t even get it to create a new Calendar)
    Do I need to link to the same Gmail account? (I wouldn’t assume so)

    Like

    • Josh Long November 6, 2018 / 9:09 pm

      I found my issue. I needed to grant calendar permissions to the new API Account email. Working so far tho!

      Like

  5. Siva Kumar November 1, 2018 / 12:38 pm

    Hi Amit, Can I have the code for GoogleCalendarActionsController and GoogleCalenderApi

    Like

    • Amit Singh November 5, 2018 / 3:38 am

      Yes of course here are both
      public class GoogleCalendarActionsController {
      public static String Summary { get; set; }
      Public Static String allCalendars { get; set; }
      public Static Boolean isListCalendars { get; set; }

      public static void doListAllCalendar(){
          List<Google_Token__c> tokenList = new List<Google_Token__c>();
          tokenList = [Select Id, Name, Access_Token__c, Refresh_Token__c, Expires_In_Seconds__c, Expires_In__c
                       from Google_Token__c Where Name='Google Product'];
          String accessToken = tokenList[0].Access_Token__c;
          String endPoint = 'https://www.googleapis.com/calendar/v3/users/me/calendarList';
      
          Http http = new Http();
          HttpRequest httpReq = new HttpRequest();
          HttpResponse HttpRes = new HttpResponse();
      
          httpReq.setEndpoint(endpoint);
          httpReq.setMethod('GET');
          httpReq.setHeader('Content-Type', 'application/json');
          httpReq.setHeader('Authorization','Bearer '+accessToken);
          try{
              HttpRes = http.send(httpReq);
              if(httpRes.getStatusCode() == 200){
                  isListCalendars = true;
                  System.debug('#### HtteRes '+HttpRes.getBody());
                  allCalendars = HttpRes.getBody();
                  ApexPages.addmessage(new ApexPages.message(
                      ApexPages.severity.CONFIRM,'Calendar List Retrieved Successfully '));
              }else{
                  String errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                      +'Status '+HttpRes.getStatus()+' and Status Code '+HttpRes.getStatuscode();
                  ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,errorMessage));
              }
          }catch(System.Exception e){
              System.debug('#### Exception Executed '+e.getStackTraceString() +'  '+e.getMessage());
          }
      }
      
      public static void doCreateNewCalendar(){
          List<Google_Token__c> tokenList = new List<Google_Token__c>();
          tokenList = [Select Id, Name, Access_Token__c, Refresh_Token__c, Expires_In_Seconds__c, Expires_In__c
                       from Google_Token__c Where Name='Google Product'];
          String accessToken = tokenList[0].Access_Token__c;
          if(Summary == null || Summary == ''){
              ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please Enter Calendar Title!'));
              return ;
          }
          String requestBody = '{'+
              '"summary":'+'"'+ Summary+'"'+
              '}';
          System.debug('#### requestBody '+requestBody);
          Http http = new Http();
          HttpRequest httpReq = new HttpRequest();
          HttpResponse HttpRes = new HttpResponse();
      
          httpReq.setEndpoint('https://www.googleapis.com/calendar/v3/calendars');
          httpReq.setMethod('POST');
          httpReq.setBody(requestBody);
          httpReq.setHeader('Content-Type', 'application/json');
          httpReq.setHeader('Authorization','Bearer '+accessToken);
          try{
              HttpRes = http.send(httpReq);
              if(HttpRes.getStatusCode() == 200){
                  isListCalendars = false;
                  allCalendars = '';
                  ApexPages.addmessage(new ApexPages.message(
                      ApexPages.severity.CONFIRM,'Calendar Created Successfully  '+'\n'+' '+
                      HttpRes.getBody()));
              }else{
                  String errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                      +'Status '+HttpRes.getStatus()+' and Status Code '+HttpRes.getStatuscode();
                  ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,errorMessage));
              }
          }catch(System.Exception e){
              System.debug('#### Exception Executed : '+e.getMessage() + '  '+e.getStackTraceString() + ' '+e.getLineNumber());
          }
      }
      
      public static void doCreateNewCalendarEvent(){
          List<Google_Token__c> tokenList = new List<Google_Token__c>();
          tokenList = [Select Id, Name, Access_Token__c, Refresh_Token__c, Expires_In_Seconds__c, Expires_In__c
                       from Google_Token__c Where Name='Google Product'];
          String accessToken = tokenList[0].Access_Token__c;
          //String accessToken = tokenList[0].Access_Token__c;
      
          String createEventEndPoint = 'https://www.googleapis.com/calendar/v3/calendars/'+ 'cse.amitallenhouse@gmail.com' +'/events?sendNotifications=true';
      
          String createEventBody =  '{' +
              '"attendees": ['+
              '{'+
              '"email": "amit.singh1@puresoftware.com"'+ 
              '},'+
              '{'+
              '"email": "amitsfdcdev@gmail.com"'+
              '}'+
              '],'+
              '"attachments": ['+
              '{'+
              '"fileUrl": ""'+
              '}'+
              '],'+
              '"end": {'+
              '"dateTime": "2017-11-11T03:30:00-07:00"'+
              '},'+
              '"reminders": {'+
              '"useDefault": true'+
              '},'+
              '"start": {'+
              '"dateTime": "2017-11-11T03:30:00-06:00"'+
              '},'+
              '"summary": "This is Test Event Using Calendar API ",'+
              '"location": "B 24 Noida Sec 65"'+
              '}';
          System.debug('#### createEventBody  '+createEventBody );
          Http http = new Http();
          HttpRequest httpReq = new HttpRequest();
          HttpResponse HttpRes = new HttpResponse();
      
          httpReq.setEndpoint(createEventEndPoint);
          httpReq.setMethod('POST');
          httpReq.setBody(createEventBody );
          httpReq.setHeader('Content-Type', 'application/json');
          httpReq.setHeader('Authorization','Bearer '+accessToken);
          try{
              HttpRes = http.send(httpReq);
              if(HttpRes.getStatusCode() == 200){
                  ApexPages.addmessage(new ApexPages.message(
                      ApexPages.severity.CONFIRM,'Calendar Event Successfully  '+'\n'+' '+
                      HttpRes.getBody()));
              }else{
                  String errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                      +'Status '+HttpRes.getStatus()+' and Status Code '+HttpRes.getStatuscode();
                  ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,errorMessage));
              }
          }catch(System.Exception e){
              System.debug('#### Exception Executed : '+e.getMessage() + '  '+e.getStackTraceString() + ' '+e.getLineNumber());
          }
      }
      

      }

      public class GoogleCalenderApi {

          public static Boolean isAccessToken { get; set; }
      
          // Your CLient ID Here
          public Final static String consumerKey='66961230764-r1vo4jmpuigh9ijl9scgfoadnpdtpadv.apps.googleusercontent.com'; 
          // Your Client Secret Here
          public Final static String clientSecret='nmrO4RY7EGd2_9OpXx7MmX7f'; 
      
          public static String googleoAuthUrl='https://accounts.google.com/o/oauth2/auth?'; 
          // Your redirect URI here that you entered while creating the App in Google API console
          public static String redirect_uri = 'https://dreamhouse-a-dev-ed--c.ap5.visual.force.com/apex/GoogleCalenderoAuth'; 
      
          public static String calendar_Scope = 'https://www.googleapis.com/auth/calendar'; 
      
          /* If you want to use Google Analytics OR any of the Google API then You just need to change the Scope 
             According to API and every thing will be same. OR you can create a new custom one for each API 
             so that it will be easy to maintain the access token and refresh token
          */
          //public static String analytics_Scope = 'https://www.googleapis.com/auth/analytics';
      
      
          /* Constructor */
          public GoogleCalenderApi(){
      
          }
      
          public PageReference authorization(){  
      
              String request_Body = googleoAuthUrl+'redirect_uri='+redirect_uri+'&response_type=code&client_id='+consumerKey+
                                          '&scope='+calendar_Scope+'&prompt=consent&access_type=offline&include_granted_scopes=true';
      
              /*
                  String body = googleoAuthUrl+'redirect_uri='+redirect_uri+'&response_type=code&client_id='+consumerKey +
                  '&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&approval_prompt=force&access_type=offline';
              */
      
              PageReference pr = new PageReference(request_Body); 
              return pr;
          }
      
          public static PageReference doFetchAccessToken(){ 
      
              String authCode = ApexPages.currentPage().getParameters().get('code');
              String errorMessage = '';
      
              String endPoint = 'https://www.googleapis.com/oauth2/v4/token';
              String authTokenBody = authCode;
      
              String requestTokenBody = 'code='+authCode+'&client_id='+consumerKey+'&client_secret='+
                                              clientSecret+'&redirect_uri='+redirect_uri+
                                                  '&grant_type=authorization_code';
      
              Http http = new Http();
              httpRequest httpReq = new httpRequest();
              HttpResponse response = new HttpResponse();
              httpReq.setEndPoint(endPoint);
              httpReq.setBody(requestTokenBody);
              httpReq.setMethod('POST');
              try{
                  response = http.send(httpReq);
                  if(response.getStatuscode()==200){
                      PageReference pageRef = new PageReference('/apex/GoogleCalendarActions');
                      pageRef.setRedirect(true);
                      Map<String,object> TokenInfo = (Map<String,object>)JSON.deserializeUntyped(response.getBody());
                      System.debug('#### TokenInfo '+TokenInfo);
                      List<GoogleCalenderInfo__c> googleSettingInfoList = new List<GoogleCalenderInfo__c>();
                      googleSettingInfoList = GoogleCalenderInfo__c.getAll().values();
      
                      if(googleSettingInfoList.size() > 0 ){
      
                          GoogleCalenderInfo__c googleSettingInfo = googleSettingInfoList[0];
                          googleSettingInfo.Access_Token__c = String.valueOf(TokenInfo.get('access_token'));
                          googleSettingInfo.Expire_In__c = Double.valueOf(TokenInfo.get('expires_in'));
                          googleSettingInfo.Refresh_Token__c = String.valueOf(TokenInfo.get('refresh_token'));
      
                          update new List<GoogleCalenderInfo__c>{googleSettingInfo};
                      }else{
      
                          GoogleCalenderInfo__c googleSettingInfo = new GoogleCalenderInfo__c();
                          googleSettingInfo.Name = 'Google CalenderInfo';
                          googleSettingInfo.Access_Token__c = String.valueOf(TokenInfo.get('access_token'));
                          googleSettingInfo.Expire_In__c = Double.valueOf(TokenInfo.get('expires_in'));
                          googleSettingInfo.Refresh_Token__c = String.valueOf(TokenInfo.get('refresh_token'));
      
                          insert new List<GoogleCalenderInfo__c>{googleSettingInfo};
                      }
                      return pageRef;
                  }else{
                      errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                          +'Status '+response.getStatus()+' and Status Code '+response.getStatuscode();
                      return null;
                  }     
              }catch(System.Exception e){
                  if(String.valueOf(e.getMessage()).startsWith('Unauthorized endpoint')){
                      errorMessage = 'Unauthorize endpoint: An Administer must go to Setup -> Administer -> Security Control ->'
                          +' Remote Site Setting and add '+' '+ endPoint +' Endpoint';
                      return null;
                  }else{
                      errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                          +'Status '+response.getStatus()+' and Status Code '+response.getStatuscode();
                      return null;
                  }
              }  
              return null;
          }
      
          public static void doRefreshToken(){
      
              String errorMessage ='';
      
              Http http = new Http();
              HttpRequest httpReq = new HttpRequest();
              HttpResponse httpRes = new HttpResponse();
              httpReq.setEndpoint('https://www.googleapis.com/oauth2/v4/token');
              httpReq.setMethod('POST');
              httpReq.setHeader('Content-Type', 'application/x-www-form-urlencoded');
      
              List<GoogleCalenderInfo__c> googleSettingInfoList = new List<GoogleCalenderInfo__c>();
              googleSettingInfoList = GoogleCalenderInfo__c.getAll().values();
              String refreshToken;
              if(googleSettingInfoList.size() > 0 )
                      refreshToken = googleSettingInfoList[0].Refresh_Token__c;
      
              System.debug('#### refreshToken '+refreshToken);
              String refreshTokenBody = 'client_id='+consumerKey+'&client_secret='+clientSecret+'&refresh_token='+refreshToken
                                              +'&grant_type=refresh_token';
              System.debug('#### refreshTokenBody '+refreshTokenBody);
      
              httpReq.setBody(refreshTokenBody);
      
              try{
                 httpRes = http.send(httpReq); 
                  if(httpRes.getStatusCode() == 200){
                      Map<String,object> TokenInfo = (Map<String,object>)JSON.deserializeUntyped(httpRes.getBody());
                      GoogleCalenderInfo__c googleSettingInfo = googleSettingInfoList[0];
                      googleSettingInfo.Access_Token__c = String.valueOf(TokenInfo.get('access_token'));
                      googleSettingInfo.Expire_In__c = Double.valueOf(TokenInfo.get('expires_in'));
                      //googleSettingInfo.Refresh_Token__c = String.valueOf(TokenInfo.get('refresh_token'));
                      System.debug('do Refresh Token '+googleSettingInfo);
                      update new List<GoogleCalenderInfo__c>{googleSettingInfo};
                  }else{
                      errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                          +'Status '+httpRes.getStatus()+' and Status Code '+httpRes.getStatuscode();
                  }
              }catch(System.Exception e){
      
                  System.debug('#### Exception Executed '+e.getStackTraceString() + ' '+e.getMessage());
                  if(String.valueOf(e.getMessage()).startsWith('Unauthorized endpoint')){
                      errorMessage = 'Unauthorize endpoint: An Administer must go to Setup -> Administer -> Security Control ->'
                          +' Remote Site Setting and add '+' '+ 'https://www.googleapis.com/oauth2/v4/token' +' Endpoint';
                  }else{
                      errorMessage = 'Unexpected Error while communicating with Google Calendar API. '
                          +'Status '+httpRes.getStatus()+' and Status Code '+httpRes.getStatuscode();
                  }
              }
          }
      }</code>
      

      Like

  6. Josh Long October 30, 2018 / 3:41 pm

    Thanks Amit this looks amazing!!

    One question I have is if this would work to have it link to Community Users Gmail accounts.
    So we would have a Business Account as the API and App account but then have “Users” as portal users linking their personal Gmail Accounts to pull and sync their Events.

    I want to assume it will work but figured I would ask before trying.

    Like

    • Amit Singh October 31, 2018 / 4:05 am

      Yes. It will work. The only thing you need to do is to provide the access to Page/Class and Objects where you are storing the tokens.

      Like

  7. Romain November 27, 2017 / 6:05 pm

    Hi Amit,

    thanks for the article, it has been very helpful.

    When the access token is not working anymore, I would like to use the GoogleCalenderApi.doRefreshToken() method in order to get a valid access token.

    It is not easy since in order to do this, you need to chain 2 http requests which are asynchronous.

    Any idea about how to do this?

    Like

    • Amit Singh November 28, 2017 / 8:22 am

      Thanks for the complement,

      Will post a block of code soon for the same.

      Like

      • Romain November 28, 2017 / 9:23 am

        Thanks Amit, that would be awesome.

        Like

  8. poker rooms October 16, 2017 / 1:13 am

    *I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking forward to reading more from you later on!?

    Like

  9. Megha October 13, 2017 / 12:10 pm

    Can we integrate google calender in lightning using components?

    Like

    • Amit Singh October 13, 2017 / 12:12 pm

      Yes, we definitely can. You can try any problem I will help you

      Like

      • Megha October 13, 2017 / 12:15 pm

        Do you have any reference?Can u post here…

        Like

      • Amit Singh October 13, 2017 / 12:20 pm

        At present, I don’t have but I will post ASAP :). in the mean time you can try by yourself 🙂

        Like

  10. Megha October 12, 2017 / 11:07 am

    Can u tell how to send google calender invitation through apex code?

    Like

      • Megha October 13, 2017 / 6:17 am

        Hii Amith,

        While creating an event that attendies should also get an invitation email,it will create an event in attendies calender but is there anyway to send event invitation email.

        Like

      • Amit Singh October 13, 2017 / 6:55 am

        Hi Megha,

        Let me check for this and I will get back to you ASAP 🙂

        Like

      • Megha October 13, 2017 / 7:24 am

        Thanks Amith.It works….

        Like

      • Amit Singh October 13, 2017 / 8:03 am

        Great happy to help you 🙂

        Like

  11. PK October 10, 2017 / 7:11 am

    Can u tell how to create an calendar event??

    Like

    • Amit Singh October 10, 2017 / 8:27 am

      Hi Pavan,

      Yes, Please use the below code for Creating a new Event into Google Calendar. For testing purpose I have hardcoded the Event body make sure you are passing the dynamic body as per your requirement.

      Find new Apex Class method

      public static void doCreateNewCalendarEvent(){
      List googleSettingInfoList = new List();
      googleSettingInfoList = GoogleCalenderInfo__c.getAll().values();
      String accessToken = googleSettingInfoList[0].Access_Token__c;

      String createEventEndPoint = ‘https://www.googleapis.com/calendar/v3/calendars/’+ calendarIdHere (Your/Organizer Email here) +’/events’;

      String createEventBody = ‘{‘ +
      ‘”attendees”: [‘+
      ‘{‘+
      ‘”email”: “cse.amitallenhouse@gmail.com”‘+
      ‘},’+
      ‘{‘+
      ‘”email”: “cse.amitallenhouse@gmail.com”‘+
      ‘}’+
      ‘],’+
      ‘”attachments”: [‘+
      ‘{‘+
      ‘”fileUrl”: “”‘+
      ‘}’+
      ‘],’+
      ‘”end”: {‘+
      ‘”dateTime”: “2017-11-11T03:30:00-07:00″‘+
      ‘},’+
      ‘”reminders”: {‘+
      ‘”useDefault”: true’+
      ‘},’+
      ‘”start”: {‘+
      ‘”dateTime”: “2017-11-11T03:30:00-06:00″‘+
      ‘},’+
      ‘”summary”: “This is Test Event Using Calendar API “,’+
      ‘”location”: “B 24 Noida Sec 65″‘+
      ‘}’;
      System.debug(‘#### createEventBody ‘+createEventBody );
      Http http = new Http();
      HttpRequest httpReq = new HttpRequest();
      HttpResponse HttpRes = new HttpResponse();

      httpReq.setEndpoint(createEventEndPoint);
      httpReq.setMethod(‘POST’);
      httpReq.setBody(createEventBody );
      httpReq.setHeader(‘Content-Type’, ‘application/json’);
      httpReq.setHeader(‘Authorization’,’Bearer ‘+accessToken);
      try{
      HttpRes = http.send(httpReq);
      if(HttpRes.getStatusCode() == 200){
      ApexPages.addmessage(new ApexPages.message(
      ApexPages.severity.CONFIRM,’Calendar Event Successfully ‘+’\n’+’ ‘+
      HttpRes.getBody()));
      }else{
      String errorMessage = ‘Unexpected Error while communicating with Google Calendar API. ‘
      +’Status ‘+HttpRes.getStatus()+’ and Status Code ‘+HttpRes.getStatuscode();
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,errorMessage));
      }
      }catch(System.Exception e){
      System.debug(‘#### Exception Executed : ‘+e.getMessage() + ‘ ‘+e.getStackTraceString() + ‘ ‘+e.getLineNumber());
      }
      }

      Below is Apex page code to call the method

      Keep learning 🙂

      Let me know if you have any issue 🙂

      Like

      • PK October 11, 2017 / 6:46 am

        tq amit. It works

        Like

      • prasad October 11, 2017 / 9:33 am

        hii amith,
        Instead of hard coding values,if I bind a variable a status 400 error is throwing,can u give an example to one of event attributes(In createeventbody) to bind a variable.

        Like

      • Amit Singh October 11, 2017 / 5:02 pm

        What code are you using for dynamic binding please post your VF and controller code here

        Like

      • Amit Singh October 13, 2017 / 8:04 am

        Prasad were you able to resolve the same?

        Like

      • Pavankumar.G November 27, 2017 / 12:39 pm

        Hi Amit,
        How to add attachments to this event?
        What does fileurl mean?

        Like

      • Amit Singh November 28, 2017 / 8:25 am

        Will post the code for the soon ASAP.

        Like

      • Chandresh Gupta November 13, 2018 / 9:38 am

        Hi Amit,

        Can you please tell us how to make dynamic event Body

        Like

      • Chandresh Gupta November 16, 2018 / 4:14 am

        Hi Amit,

        I am facing the error while executing the code Error Name is “Invalid Credential”

        but when i am connecting through your Visualforce page GoogleCalenderOauth that time i am able to connecting with my Google calender.

        Please help me out to find the Solution.

        Like

      • Amit Singh November 25, 2018 / 3:14 pm

        Invalid credentials mean that either your google credentials are wrong or API Key and API Secret or wrong. Also, I will suggest creating the App in your google console because it requires the redirect URL.

        Like

Leave a comment