Zoom Date format issue

When we schedule a Zoom meeting from our application , the meeting scheduled in Zoom is not picking the right date (in meetings under upcoming tab).

For example, when we schedule a meeting for a date from next week in our application, the date that we see in Zoom’s “Upcoming Meeting” tab is the current timestamp as Meeting start time instead of the start time which we’ve given as some date in the next week.

We tried to resolve the issue in the development application, however we could not fix it. So we are requesting you to please help us on this.

Hey @mahesh.sanga,

Thank you for reaching out to the Zoom Developer Forum. Are you able to provide an example of the request you’re making to the Create a Meeting API when you see this behavior?

I’ll use that to reproduce the issue on my end.

Thanks,
Max

Hi MaxM

Thank you for your response on this, I am requesting you to please consider the following points to reproduce the issue.

1.When we schedule a zoom meeting from our application for a next week.

Please refer the below screen shot.

Screenshot #1

2.The Meeting schedule in the Zoom is not pick right date (in meetings under upcoming tab) from our application.

Please refer the below screen shot.

Screenshot #2

In the above screenshot i.e.(in meetings under upcoming tab) it’s showing current time stamp instead of the start time
Which we have given same date in the next week in our application i.e(Screenshot #1)

please find attachment Screenshot #2 to next post

note: I am not unable to post more than one screenshot.

Screenshot #2

Hey @mahesh.sanga,

Thanks for providing more detail. When your application creates this meeting, it’s making a request to the Create a Meeting API, correct?

If so, are you able to share the request body that your app is using when you see this problem?

Thanks,
Max

public async Task CreateZoomMeeting(string orgName, string appointmentId)
{
var messageList = new List<KeyValuePair<string, string>>();

        if (string.IsNullOrEmpty(orgName))      
            messageList.Add(new KeyValuePair<string, string>("Information", string.Format("Organization is Required")));

        if (string.IsNullOrEmpty(appointmentId))
            messageList.Add(new KeyValuePair<string, string>("Information", string.Format("Appointment Id is Required.  Save Appointment and Proceed")));

        if (messageList.Count > 0)
        {
            TempData["ValidationSummary"] = messageList;
            return RedirectToAction("Index", "Home");
        }

        TempData["orgName"] = orgName;
        TempData.Keep("orgName");

        TempData["appointmentId"] = appointmentId;
        TempData.Keep("appointmentId");

        ZoomTokenModel zoomTokenModel = new ZoomTokenModel();

        ResponseRoot resposneObj = new ResponseRoot();
        string _response = string.Empty;
        try
        {
            service = Connections.ConnectToCRM(service, orgName);

            Tokens = Connections.TokenCollection(service, Tokens);
            appointmentCollection = Connections.zoomCollection(service, appointmentId, appointmentCollection);
            Entity appointmentEntity = appointmentCollection.Entities.Where(x => x.Id.ToString().ToLower() == appointmentId.ToLower().ToString()).FirstOrDefault();
            if (appointmentEntity == null)
            {
                TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Appointment details does not exists!")};
                return RedirectToAction("Index", "Home");
            }
            if (string.IsNullOrEmpty(appointmentEntity.Id.ToString()))
            {
                TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Appointment details does not exists!")};
                return RedirectToAction("Index", "Home");
            }

            if (Tokens != null && Tokens.Entities.Count > 0)
            {
                Root rootObj = new Root();
                var tokenEntity = Tokens.Entities.FirstOrDefault();
                var accessTokenValue = tokenEntity.Attributes.FirstOrDefault(x => x.Key == "accesstokenvalue").Value;
                var zen_refreshtoken = tokenEntity.Attributes.FirstOrDefault(x => x.Key == "refreshtoken").Value;

                string clientId = ConfigurationManager.AppSettings["clientId"].ToString();
                string clientSecret = ConfigurationManager.AppSettings["clientSecret"].ToString();

                // Recommended - do refresh access token each time we fire the api 
                if (!string.IsNullOrEmpty(accessTokenValue.ToString()))
                {
                    try
                    {
                        using (var httpClient = new HttpClient())
                        {
                            string urlString = "https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=refresh_token$";
                            urlString = urlString.Replace("refresh_token$", zen_refreshtoken.ToString());

                            using (var request = new HttpRequestMessage(new HttpMethod("POST"), urlString))
                            {
                                string authorizationString = "Basic " + Base64Encode(clientId + ":" + clientSecret).ToString();
                                request.Headers.TryAddWithoutValidation("Authorization", authorizationString);

                                var response = await httpClient.SendAsync(request);
                                zoomTokenModel = GetResponse<ZoomTokenModel>(response).Result;
                            }

                            try
                            {
                                if (!tokenEntity.Attributes.Contains("accesstokenvalue"))
                                {
                                    tokenEntity.Attributes.Add("accesstokenvalue", zoomTokenModel.access_token);
                                }
                                else
                                {
                                    tokenEntity["zen_accesstokenvalue"] = zoomTokenModel.access_token;
                                }

                                if (!tokenEntity.Attributes.Contains("refreshtoken"))
                                {
                                    tokenEntity.Attributes.Add("refreshtoken", zoomTokenModel.refresh_token);
                                }
                                else
                                {
                                    tokenEntity["refreshtoken"] = zoomTokenModel.refresh_token;
                                }

                                if (!tokenEntity.Attributes.Contains("apptype"))
                                {
                                    tokenEntity.Attributes.Add("apptype", new OptionSetValue(282230002));
                                }
                                else
                                {
                                    tokenEntity["apptype"] = new OptionSetValue(282230002);
                                }
                                service.Update(tokenEntity);
                            }
                            catch(Exception ex)
                            {
                                //
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", ex.Message)};
                        return RedirectToAction("Index", "Home");
                    }
                }

                if (string.IsNullOrEmpty(zoomTokenModel.access_token))
                {
                    TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Unauthorized")};
                    return RedirectToAction("Index", "Home");
                }

                
                if (appointmentEntity != null)
                {
                    if (!string.IsNullOrEmpty(appointmentEntity.Id.ToString()))
                    {

                 #start Reference
  // we are passing input parameters start_time,end_time and topic  to zoom
                        rootObj.start_time = appointmentEntity.Attributes.FirstOrDefault(x => x.Key == "scheduledstart").Value.ToString();
                        rootObj.end_time = appointmentEntity.Attributes.FirstOrDefault(x => x.Key == "scheduledend").Value.ToString();
                        rootObj.topic = appointmentEntity.Attributes.FirstOrDefault(x => x.Key == "subject").Value.ToString();
                        DateTime startTime = DateTime.Parse(resposneObj.start_time);
                        DateTime endTime = DateTime.Parse(rootObj.end_time);
                        startTime.ToString("HH:mm");
                        endTime.ToString("HH:mm");
                        TimeSpan difference = endTime - startTime;

                        int hours = difference.Hours;
                        int minutes = difference.Minutes;
                        BigInteger _minutes = hours * 60;
                        BigInteger _totalDuration = _minutes + minutes;
                        rootObj.duration = Convert.ToString(_totalDuration);

                        var jsonObj = new JavaScriptSerializer().Serialize(rootObj);

                        var client = new RestClient("https://api.zoom.us/v2/users/me/meetings");
                        var request = new RestRequest(Method.POST);

                        request.AddHeader("content-type", "application/json");
                        request.AddHeader("authorization", "Bearer" + zoomTokenModel.access_token);
                        request.AddParameter("application/json", jsonObj, ParameterType.RequestBody);
                        IRestResponse response = client.Execute(request);
                        if (response.StatusCode.ToString() == "Unauthorized")
                        {
                            TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Unauthorized")};
                            return RedirectToAction("Index", "Home");
                        }
                        resposneObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseRoot>(response.Content);

                        try
                        {
                            string title = "Zoom Meeting Details";
                            var desc = "<br>" + "<br><b>" + title + "</b>" + "<br>" + "<br>" + "Topic:" + " " + resposneObj.topic + "<br>" + "Time:" + " " + resposneObj.start_time + "<br>" + "<br>" + "Join Zoom Meeting" + "<br>" + "<a href>" + resposneObj.join_url + "</a>" + "<br>" + "<br>" + "Meeting ID:" + " " + resposneObj.id + "<br>" + "Passcode:" + " " + resposneObj.password;

end Reference

                            if (appointmentEntity.Attributes.Contains("description"))
                            {
                                appointmentEntity["description"] = appointmentEntity["description"] + desc;
                            }
                            else
                            {
                                appointmentEntity.Attributes.Add("description", desc);
                            }

                            service.Update(appointmentEntity);
                        }
                        catch(Exception ex)
                        {
                            TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Failed to Update Zoom Meeting - " + ex.Message)};
                            return RedirectToAction("Index", "Home");
                        }
                    }
                }
            }
            else
            {
                TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Zoom Single-Singon Authorization is Required!")};
                return RedirectToAction("Index", "Home");
            }
        }
        catch (Exception ex)
        {
            TempData["ValidationSummary"] = new List<KeyValuePair<string, string>> {
                                new KeyValuePair<string, string>("Error", "Unauthorized - " + ex.Message)};
            return RedirectToAction("Index", "Home");
        }

        return View("Success");
    }

note:- please refer the above code from #Start Reference to #endReference region code for Request body of zoom.

Hey @mahesh.sanga,

Thanks for providing a code snippet. Unfortunately, I’m not able to see the JSON request body that is being used as I’m only able to see the variable name jsonObj.

Would you be able to send me the JSON Object that you’re using for the request body when you see this issue instead?

Thanks,
Max