none
Outlook 2010 - sometimes drag and drop meetings in calendar end up in "Cannot move the items. The end date you entered occurs before the start date." error message RRS feed

  • Question

  • Hello Friends,

    I am working on a requirement to handle drag & drop feature of Outlook in our project and facing below issues. 

    Issue 1. Sometimes whenever I drag and drop meetings in calendar it ends up with "Cannot move the items. The end date you entered occurs before the start date." error message.

    Any idea why is that? I read in some forums that this could be related to Work Hours in calendar. I recently updated it to start 1 hour back than usual i.e. Start Time = 7:00 AM and End Time = 5:00 PM. Is it true or there is any other reason? How can i fix this issue?

    Issue 2. Additionally, sometimes when I drag & drop a meeting by mouse to another slot, it spans the whole time starting from start time of dragged meeting and ends in the new slot I dragged into.

    e.g. this meeting was of 30 mins slot originally

    Any idea why this happens?

    Issue 3. When I drag & drop past meeting into past datetime slot, it opens and then closes automatically. I am not closing it anywhere explicitly, then why would it close by itself?

    My code is here:

    void _explorer_BeforeItemPaste(ref object clipboardContent, MAPIFolder target, ref bool cancel)
    {
        try
        {
                _appointment = GetAppointmentItem(); //gives currently selected item, also tried using clipboardContent item
                if (_appointment == null) return;
                _itemPasted = true;
                _appointmentOldDateTime = _appointment.End;
                _displayAppointment = false;
                _appointment.PropertyChange += _appointment_PropertyChange;
        }
        catch (Exception ex)
        {
            //log error
        }
    }
    
    private void _appointment_PropertyChange(string Name)
    {
        if (!_displayAppointment && _appointment != null)
        {
            if(Name.ToLower().Equals("end"))
            {
    			_displayAppointment = true; //to stop multiple times
                _appointment.Display(false); //when i pass true here, 3rd issue does not happen, but it opens that meeting in modal dialog, and i wont want it that way.
            }
        }
    }


    Thanks.


    • Edited by sureshh Wednesday, July 26, 2017 2:29 PM added one more question
    Tuesday, July 25, 2017 8:26 PM

All replies

  • Hi sureshh,

    I have tested the drag & drop feature as you said, but did not get error. Have you customized the drag & drop feature before the problem happened? If you have customized the problem before, please provide your steps or the code so we could try to reproduce your issue.

    Best Regards,

    Terry

    Wednesday, July 26, 2017 9:01 AM
  • Thanks Terry, i have update the original question with more details. Please advise.

    sureshh...

    Wednesday, July 26, 2017 2:29 PM
  • An update - I was able to fix issue #3 here. The issue was look like in the past to past drag & drop scenario item gets saved automatically, and we need to stop that save operation. So far all working fine with this scenario now.

    I am still facing issue #1 & 2. Please advise.


    sureshh...

    Thursday, July 27, 2017 12:39 PM
  • Hi sureshh,

    I tried to test your code but failed to reproduce your issue. Why do you customize the drag& drop function? Whats  your expected result?

    What's function of the _appointmentOldDateTime ? I suggest you provide more complete code for understanding.

    Besides, if you dont customize the drag& drop function, will you get the result?

    Best Regards,

    Terry


    Friday, July 28, 2017 2:01 AM
  • Hi Terry,

    Please note that the code provided here is short version of original code, and I am simply trying to explicitly open any item that gets dragged from old time slot to new time slot. The reason I am using PropertyChange event here is to understand if item is really dragged to new slot, and if yes to which slot - past or future using old EndTime & new EndTime comparing it with DateTime.Now. And so I cannot get results I am expecting without customizing drag & drop.

    Is there any other way I should implement to get expected results here? Also I am looking for a solution that needs to work in both own calendar as well while working on shared calendar.

    Thanks.

    • Edited by sureshh Monday, July 31, 2017 4:02 PM
    Monday, July 31, 2017 2:59 PM
  • Hi sureshh,

    I tried to set end time of an appointment before start time manually, and then I got a similar error with you: "The end date you entered occurs before the start date." So I think the error may be caused by setting end time before start time. Have you tried to reset the end time of the appointment in these events? Have you debug the code? When error occurs, what's the end time and start time of the appointment?

    Best Regards,

    Terry

    Tuesday, August 1, 2017 8:10 AM