public SynchronEvent ConvertOutlookToMyEvent(Microsoft.Office.Interop.Outlook.AppointmentItem outlookItem) { var result = new SynchronEvent() .SetStart(outlookItem.Start) .SetDuration(outlookItem.Duration) .SetLocation(outlookItem.Location) .SetSubject(outlookItem.Subject) .SetCompanions(outlookItem.RequiredAttendees) .SetId(outlookItem.GlobalAppointmentID) .SetFinish(outlookItem.End) .SetSource(_outlook) .SetDescription(outlookItem.Body) .SetPlacement(_outlook) .SetAllDay(outlookItem.AllDayEvent); if (!string.IsNullOrEmpty(outlookItem.Mileage)) { result.SetId(outlookItem.Mileage); if (outlookItem.Mileage.IndexOf(_outlook) > -1) { result.SetSource(_outlook); } else { result.SetSource(_google); outlookItem.Categories = "Orange Category"; outlookItem.Save(); } } else { Guid id = Guid.NewGuid(); outlookItem.Mileage = _outlook + id.ToString(); outlookItem.Save(); result.SetSource(_outlook); result.SetId(outlookItem.Mileage); } return(result); }
private bool NeedToUpdate(SynchronEvent standartEvent, SynchronEvent compareEvent) { return(!standartEvent.CompareOnEqual(compareEvent)); }
public Microsoft.Office.Interop.Outlook.AppointmentItem ConvertSynchronToOutlook(SynchronEvent synchronEvent) { var outlookApp = new outlook2.Application(); var result = (outlook2.AppointmentItem)outlookApp.CreateItem(outlook2.OlItemType.olAppointmentItem); result.Start = synchronEvent.GetStart(); result.End = synchronEvent.GetFinish(); result.Subject = synchronEvent.GetSubject(); result.Location = synchronEvent.GetLocation(); result.Body = synchronEvent.GetDescription(); result.AllDayEvent = synchronEvent.GetAllDay(); string buf = ""; List <string> AllParticipants = synchronEvent.GetParticipants(); for (int i = 0; i < AllParticipants.Count; ++i) { if (i + 1 < AllParticipants.Count) { buf = buf + AllParticipants[i] + "; "; } else { buf = buf + AllParticipants[i]; } } result.RequiredAttendees = buf; result.ResponseRequested = true; if (synchronEvent.GetSource() == _google) { result.Mileage = synchronEvent.GetId(); result.Categories = "Orange Category"; } return(result); }