private void StartListeners() { try { LocationHelper.StartTracking(); SensorHelper.StartTracking(); BatteryHelper.StartTracking(); GTalkHelper.StartTracking(); SkypeHelper.StartTracking(); OutlookHelper.StartTracking(); DropboxHelper.StartTracking(); } catch (Exception exception) { Log.Error(exception); } }
/// <summary> /// Method that initializes the Outlook plugin, by checking if all necessary elements (s.a. the redmine calendar) exist. /// It creates those necessary elements if they do not already exist. /// </summary> /// <param name="currentExplorer">The current explorer</param> private void CheckRequirements(Explorer currentExplorer) { // create the calendar folder var primaryCalendar = currentExplorer.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar); this.RedmineCalendar = OutlookHelper.CreateOrGetFolder(primaryCalendar, CalendarName, OlDefaultFolders.olFolderCalendar); OutlookHelper.CreateScorpioUserDefinedProperties(this.RedmineCalendar); OutlookHelper.CreateScorpioCategories(); this._reportCreator.CheckRequirements(currentExplorer); // create new state objects this.CalendarState = new CalendarState(); this.SyncState = new SyncState(); // create new sync objects this.Synchronizer = new Synchronizer(this.RedmineCalendar); Func <DateTime, DateTime, List <AppointmentItem> > getAppointmentsFunction = (start, end) => this.Synchronizer.Calendar.GetAppointmentsInRange(start, end, includeEnd: false); this.UiUserInfoSynchronizer = new UiUserInfoSynchronizer(getAppointmentsFunction); // add listener // ui update listener this.Synchronizer.AppointmentChanged += (sender, args) => this.UiUserInfoSynchronizer.HandleAppointmentChange(sender, args); // sync status listener this.SyncState.ConnectionStateChanged += (sender, args) => { if (this._ribbon != null) { this._ribbon.UpdateConnectionStatus(); } }; this.SyncState.StatusChanged += (sender, args) => { if (this._ribbon != null) { this._ribbon.UpdateStatus(); } }; }
private void PrepareDraftMail(bool reportHasSumRow) { Licensor licensor = LicensorsRepo.GetById((int)gridExSettlementsDetails.GetDataRows()[1].Cells["tLicencjodawcaCafreOfId"].Value); string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss"); string detailsReportPath = string.Format("{0}{1}_RaportZbiorczy.xls", ConfigurationSettings.AppSettings["mail_attachmentDirectory"], timeStamp); string shortReportPath = string.Format("{0}{1}_RaportSkrocony.pdf", ConfigurationSettings.AppSettings["mail_attachmentDirectory"], timeStamp); List <string> attachments = new List <string>(); attachments.Add(detailsReportPath); attachments.Add(shortReportPath); ExcelHelper.CreateReport_SettlementsDetails(gridExSettlementsDetails, detailsReportPath, reportHasSumRow); ExcelHelper.CreateReport_Short(gridExSettlementsDetails, shortReportPath); OutlookHelper.SaveDraft(attachments, licensor.Email); MessageBox.Show("Szkic maila zostal przygotowany wraz załącznikami.", "Eksport do email", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Sets a custom field id for an appointment /// </summary> /// <param name="item">The item to set</param> /// <param name="fieldName">The field name</param> /// <param name="value">The value</param> private static void SetAppointmentCustomId(this AppointmentItem item, string fieldName, int?value) { // if no item is given, nothing can be done if (item == null) { Log.Error(string.Format("No appointment is given, property '{0}' cannot be set.", fieldName)); return; } // get the corresponding property and set its value var property = OutlookHelper.CreateOrGetProperty(item, fieldName, OlUserPropertyType.olInteger); if (property == null) { Log.Error(string.Format("Property '{0}' of appointment {1} cannot be obtained and hence is not set.", fieldName)); } else { property.Value = value; } }
/// <summary> /// Updates the custom fields of an appointment /// </summary> /// <param name="appointment"> /// The appointment /// </param> /// <param name="timeEntryId"> /// The redmine time entry id /// </param> /// <param name="projectId"> /// The redmine project id /// </param> /// <param name="issueId"> /// The redmine issue id /// </param> /// <param name="activityId"> /// The activity Id. /// </param> /// <param name="lastRedmineUpdate"> /// The date/time when the item was updated in redmine the last time /// </param> public static void UpdateAppointmentFields( this AppointmentItem appointment, int?timeEntryId, int projectId, int issueId, int activityId, DateTime lastRedmineUpdate) { // create user properties if (timeEntryId.HasValue) { appointment.SetAppointmentCustomId(Constants.FieldRedmineTimeEntryId, timeEntryId); } appointment.SetAppointmentCustomId(Constants.FieldRedmineProjectId, projectId); appointment.SetIssueId(issueId); appointment.SetAppointmentCustomId(Constants.FieldRedmineActivityId, activityId); // create last update field var propLastUpdate = OutlookHelper.CreateOrGetProperty(appointment, Constants.FieldLastUpdate, OlUserPropertyType.olDateTime); propLastUpdate.Value = lastRedmineUpdate; }
/// <summary> /// Method that is called for initialization. It checks if all necessary items for the monthly report /// are present in the current outlook account. If those items are not present, they are created. /// </summary> /// <param name="currentExplorer">The current explorer</param> public void CheckRequirements(Explorer currentExplorer) { // create the contracts and month sheet folders var primaryNotes = currentExplorer.Session.GetDefaultFolder(OlDefaultFolders.olFolderNotes); this.ContractsFolder = OutlookHelper.CreateOrGetFolder(primaryNotes, ContractsName, OlDefaultFolders.olFolderNotes); this.MonthSheetsFolder = OutlookHelper.CreateOrGetFolder(primaryNotes, MonthSheetsName, OlDefaultFolders.olFolderNotes); // Create Field in Contracts Folder OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Startdatum", OlUserPropertyType.olDateTime); OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Enddatum", OlUserPropertyType.olDateTime); OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Wöchenliche Arbeitszeit", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Urlaubstage", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Startsaldo", OlUserPropertyType.olNumber); // Create Field in MonthSheets Folder OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Monat", OlUserPropertyType.olText); OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Soll", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Ist", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Saldo", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Urlaub genommen", OlUserPropertyType.olNumber); OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Resturlaub", OlUserPropertyType.olNumber); }
public static void ExecuteLifestyleRecipes() { try { var meetingRecipe = Repository.Instance.GetRecipe("Meeting"); if (meetingRecipe != null && meetingRecipe.IsAvailable && meetingRecipe.IsEnabled) { if (BatteryHelper.SystemInUse) //if PC is being used { string firstAppointmentInfo = OutlookHelper.GetFirstAppointmentInfo(); if (firstAppointmentInfo != null) { int alertHour = Constants.TimesOfDay[Constants.MEETING_ALERT_HOUR]; if (DateTime.Now.Hour >= alertHour & DateTime.Now.Hour <= alertHour + 1) { var arguments = new Dictionary <string, object>() { { "HeaderText", "You have a meeting!" }, { "AlertText", firstAppointmentInfo }, { "Persistent", true }, { "Delay", 500 } }; SendNotification(meetingRecipe, arguments); } } } } var timeSheetRecipe = Repository.Instance.GetRecipe("TimeSheet"); if (timeSheetRecipe != null && timeSheetRecipe.IsAvailable && timeSheetRecipe.IsEnabled) { if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday) { var work = KnownLocations.Get(KnownLocations.WORK); if (VisitedThisPlaceWithinLastNMinutes(work, 8 * 60)) //within last 8 hours { int alertHour = Constants.TimesOfDay[Constants.TIMESHEET_ALERT_HOUR]; if (DateTime.Now.Hour >= alertHour & DateTime.Now.Hour <= alertHour + 1) { var arguments = new Dictionary <string, object>() { { "HeaderText", "Remember your day?" }, { "AlertText", "Its time to fill your TimeSheet, before you leave for the day." }, { "Persistent", true }, { "Delay", 500 } }; SendNotification(timeSheetRecipe, arguments); } } } } var weeklyReportRecipe = Repository.Instance.GetRecipe("Weekly Report"); if (weeklyReportRecipe != null && weeklyReportRecipe.IsAvailable && weeklyReportRecipe.IsEnabled) { DayOfWeek dow = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), Constants.WEEKLY_SUMMARY_ALERT_DAY); if (DateTime.Now.DayOfWeek == dow) { var work = KnownLocations.Get(KnownLocations.WORK); if (VisitedThisPlaceWithinLastNMinutes(work, 8 * 60)) //within last 8 hours { int alertHour = Constants.TimesOfDay[Constants.WEEKLY_SUMMARY_ALERT_HOUR]; if (DateTime.Now.Hour >= alertHour & DateTime.Now.Hour <= alertHour + 1) { var arguments = new Dictionary <string, object>() { { "HeaderText", "1 more task before weekend!" }, { "AlertText", "Have you sent Weekly Summary Report to your manager?" }, { "Persistent", true }, { "Delay", 500 } }; SendNotification(weeklyReportRecipe, arguments); } } } } } catch (Exception exception) { Log.Error(exception); } }
public bool execute(Outlook.MailItem subject, EmailResponseConfig configCol, IDictionary <string, string> configs = null) { Outlook.MailItem reply = null; if (subject != null) { reply = subject.Reply(); } // var sbc = subject.SenderEmailAddress; if (configCol.replyRecipients == null) { reply = subject.Reply(); try { // var ignccs = ConfigurationManager.Configuration["IgnoredCCAddress"]?.Split(";"); for (int i = 1; i <= subject.Recipients.Count; i++) { var recip = subject.Recipients[i]; if (recip.Type == (int)Outlook.OlMailRecipientType.olCC) { reply.CC += (reply.CC?.Length > 0 ? ";" : "") + recip.Address; } } } catch (Exception ex) { Logger.Log(ex); } } else { reply = subject == null?(Outlook.MailItem)configCol.oApp.CreateItem(Outlook.OlItemType.olMailItem): subject.Forward(); foreach (var e in configCol.replyRecipients.Where(e => OutlookHelper.EmailAddrRegex.IsMatch(e))) { reply.Recipients.Add(e); } } if (configCol.ccRecipients != null) { reply.BCC = OutlookHelper.GetEmailString(configCol.ccRecipients); } Logger.WriteToConsole($"Prepared validation response for [{reply.Subject}]"); reply.HTMLBody = getHtmlBodyFromTemplate(configCol); var subj = reply.Subject; reply.SentOnBehalfOfName = configCol.sentonbehalf; String tdir = Path.Combine(Tools.GetExecutingPath, $"temp\\{Guid.NewGuid()}\\"); foreach (String path in configCol.attachments ?? Enumerable.Empty <String>()) { String tpath = tdir + Path.GetFileName(path); if (Tools.FileOverWriteCopy(path, tpath, false)) { reply.Attachments.Add(tpath); } else { throw new Exception("Unable to attach " + path); } } if (!reply.Recipients.ResolveAll()) { reply.CC = ""; } reply.Subject = configCol.emailSubject ?? reply.Subject; reply.Send(); Logger.WriteToConsole($"Sent [{subj}]"); Marshal.ReleaseComObject(reply); if (Directory.Exists(tdir)) { try { Directory.Delete(tdir, true); } catch (Exception ex) { Logger.Log(ex); } } reply = null; return(true); }
public override bool?process(Outlook.MailItem subject, IControl <FileInfo, IValidationConfigCol <IValidator <string, string>, EmailValidatorConfig>, Dictionary <ValidResultConfig, Dictionary <String, ValidResults> > > controller, IDictionary <string, string> configs = null) { String moveto = null, rhtml = null; bool clearCat = false, movetoinbox = false; if (subject.Attachments?.Count > 0) { Outlook.Attachment attachment = null; var attachments = subject.Attachments; Dictionary <EmailValidatorConfig, IEnumerable <Tuple <String, String, Boolean?> > > avalCols = new Dictionary <EmailValidatorConfig, IEnumerable <Tuple <String, String, Boolean?> > >(); Dictionary <ValidResultConfig, Dictionary <String, ValidResults> > resultsCol = new Dictionary <ValidResultConfig, Dictionary <String, ValidResults> >(); try { for (int i = 1; i <= attachments.Count; i++) { if (stopOnReject || error) { break; } attachment = attachments[i]; if (attachment.FileName.Split(".").Last().ToLower().Equals("xlsm")) { var d = Directory.CreateDirectory($@"temp\{Guid.NewGuid()}"); var path = Tools.GetUniqueFileName(Path.Combine(d.FullName, attachment.FileName.Replace("~", "").Trim())); attachment.SaveAsFile(path); Logger.Log($"{attachment.FileName} saved to {path} ..."); if (controller == null) { ExecuteValidationConfig(vconfigCol, avalCols, path, resultsCol); } else { resultsCol.Concat(controller.execute(new FileInfo(path), null, configs)); } } Logger.WriteToConsole($"Successfully validated {attachment.FileName}"); // Logger.WriteToConsole($"Logged to DB for [{path}], result:{DBHelper.InsertOptAttachmentReceived(new OptAttachmentReceived() { AttachmentFileName = attachment.FileName, ExecutionTime = DateTime.Now, ImportErrorMessage = String.Join(",", results.Select(r => $"[{r.Key}][{r.Value}]")), Subject = mail.Subject, SenderEmailAddress = evals[ConfigHelper.Sender_Email_Address.name], RecievedTime = mail.ReceivedTime, _ImportResult = success })}"); } var guid = Guid.NewGuid().ToString(); var evals = new Dictionary <String, String>() { { ConfigHelper.Email_Date, subject.ReceivedTime.ToString("MM/dd/yyyy HH:mm:ss") }, { ConfigHelper.Email_Subject, Tools.SafeSubstring(subject.Subject, 0, 199) }, { ConfigHelper.Sender_Email_Address, OutlookHelper.GetSenderEmailAddr(subject) }, { ConfigHelper.SN, ConsolidateHelper.TimeLapsedID } }; var pstpath = configs.ContainsKey(PSTconfigsEnum.pstPath.ToString()) ? Directory.CreateDirectory(pnc?.execute(configs[PSTconfigsEnum.pstPath.ToString()], null, null) ?? configs[PSTconfigsEnum.pstPath.ToString()]).FullName : ""; if (success && resultsCol.Any()) { foreach (var aresultsCol in resultsCol) { var tdpath = $@"temp\${Guid.NewGuid()}"; var dpath = pnc?.execute(aresultsCol.Key.targetPath, null, null) ?? aresultsCol.Key.targetPath; if (File.Exists(dpath)) { if (!Tools.FileOverWriteCopy(dpath, tdpath)) { throw new Exception($"Unable to create temp data result [{dpath}] to [{tdpath}]"); } } else if (File.Exists(aresultsCol.Key.tempatePath) && !Tools.FileOverWriteCopy(aresultsCol.Key.tempatePath, tdpath)) { throw new Exception($"Unable to create temp data result [{aresultsCol.Key.tempatePath}] to [{tdpath}] with template [{aresultsCol.Key.tempatePath}]"); } var bindmaps = getBindMaps(aresultsCol.Key); configs[XCDconfigsEnum.cwwsn.ToString()] = aresultsCol.Key.targetSheet ?? Path.GetFileNameWithoutExtension(dpath); var headersID = aresultsCol.Key.headersPath; if (!String.IsNullOrWhiteSpace(headersID) && !DATARSTHeader.headers.ContainsKey(headersID)) { YamlStream yaml = new YamlStream(); using (var sr = new FileInfo(headersID).OpenText()) yaml.Load(sr); (yaml.Documents[0].RootNode as YamlMappingNode).Children.Where(e => !ConsolidateHelper.isIgnoredHeader(e.Value?.ToString())).Select(e => new DATARSTHeader(e.Value.ToString(), headersID, DATARSTHeader.headers.GetValueOrDefault(headersID)?.FirstOrDefault(h => h.name == e.Value.ToString())?.value ?? 0)).ToArray(); } var headers = DATARSTHeader.headers?.GetValueOrDefault(headersID); var sqlPFile = String.IsNullOrWhiteSpace(aresultsCol.Key.sqlPath) ? "" : (pnc?.execute(aresultsCol.Key.sqlPath, null, null) ?? aresultsCol.Key.sqlPath); if (File.Exists(aresultsCol.Key.sqlTemplatePath)) { if (!Tools.FileOverWriteCopy(aresultsCol.Key.sqlTemplatePath, sqlPFile)) { throw new Exception("Unable to create temp data result @:" + tdpath); } } configs[PSTconfigsEnum.template.ToString()] = aresultsCol.Key.sqlQueryTemplate; Directory.CreateDirectory(Path.GetDirectoryName(sqlPFile)); Directory.CreateDirectory(Path.GetDirectoryName(dpath)); using (PersistenceSQLProcessor pp = String.IsNullOrWhiteSpace(sqlPFile) ? null : new PersistenceSQLProcessor(sqlPFile, configs.ContainsKey(PSTconfigsEnum.pstConnString.ToString()) && !String.IsNullOrWhiteSpace(configs[PSTconfigsEnum.pstConnString.ToString()]) ? configs[PSTconfigsEnum.pstConnString.ToString()] : "", bindmaps)) using (XlsxResultProcessor p = String.IsNullOrWhiteSpace(dpath) ? null : new XlsxResultProcessor(tdpath, configs[XCDconfigsEnum.cwwsn.ToString()], bindmaps, headers)) success = new XlsxConsolidator() { headers = headers, evals = evals, bindmaps = bindmaps }.consolidate(new List <IProcessor <IDictionary <String, String>, Object> >() { pp, p }, aresultsCol.Value, configs); //Transfering consolation results to designated paths if (!mergeTempResults(tdpath, dpath)) { throw new Exception($"[{dpath}] transfer filed..."); } if (!String.IsNullOrWhiteSpace(sqlPFile) && !Tools.FileOverWriteMove(sqlPFile, sqlPFile + ".sql")) { throw new Exception($"[{sqlPFile}] transfer filed..."); } } if (success) { moveto = configs[EPconfigsEnum.sucFolder.ToString()]; try { if (configs.ContainsKey(EPconfigsEnum.saveMailPath.ToString())) { saveMailtoLocal(subject, configs[EPconfigsEnum.saveMailPath.ToString()]); } } catch (Exception ex) { Logger.Log(ex); } } else { throw new Exception($"Attachment [{attachment.FileName}] consolidation filed..."); } } try { if (configs.ContainsKey(EPconfigsEnum.emailLogConnString.ToString())) { foreach (var fname in resultsCol.SelectMany(r => r.Value)) { using (PersistenceSQLProcessor pp = new PersistenceSQLProcessor(Path.Combine(pstpath, guid + ".log"), configs[EPconfigsEnum.emailLogConnString.ToString()], null)) Logger.WriteToConsole($"Logged to DB for [{fname.Key}], result:{pp.process(evals.Append(new KeyValuePair<string, string>("ImportResult", fname.Value.Any(v => v.Value == false) ? "FAIL" : "SUCCESS")).Append(new KeyValuePair<string, string>("ImportErrorMessage", Tools.SafeSubstring($"[{String.Join(",", fname.Value?.Select(v => $"{{\"{v.Key}\":\"{v.Value?.ToString() ?? "null"}\"}}"))}]", 0, 499))).Append(new KeyValuePair<string, string>("AttachmentFileName", Tools.SafeSubstring(Path.GetFileName(fname.Key), 0, 99))).Append(new KeyValuePair<string, string>("Filename", Tools.SafeSubstring(Path.GetFileName(currentEmailFilePath ?? ""), 0, 99))).Append(new KeyValuePair<string, string>("guid", guid)).ToDictionary(prop => prop.Key, prop => prop.Value), null, new Dictionary<String, String>() { { PSTconfigsEnum.template.ToString(), configs[EPconfigsEnum.emailLogTemplate.ToString()] } })}"); } } } catch (Exception ex) { Logger.Log(ex); } } catch (Exception ex) { error = true; Logger.Log(ex); rhtml = ex.StackTrace.ToString(); success = false; } finally { Marshal.ReleaseComObject(attachment); attachment = null; } if (error) { new EmailResponseController().execute(subject, new EmailResponseConfig() { oApp = oApp, defaultMessage = rhtml ?? "Error occurred!", replyRecipients = configs[EPconfigsEnum.AdminEmail.ToString()]?.Split(";") }); moveto = configs[EPconfigsEnum.rdestFolder.ToString()]; if (String.IsNullOrEmpty(moveto) || moveto == configs[EPconfigsEnum.destFolder.ToString()]) { clearCat = true; } Logger.WriteToConsole($"Prepared internal error response for [{subject.Subject}]"); } else { if (success) { clearCat = true; Logger.WriteToConsole($"Cleared mark for [{subject.Subject}]"); } if (avalCols.Any()) { foreach (var avalcol in avalCols) { var t = validColsCols.First(vc => vc == avalcol.Key); new EmailResponseController().execute(subject, new EmailResponseConfig() { oApp = oApp, replyRecipients = avalcol.Value == null ? t.sucEmails : t.rejEmails, template = avalcol.Value == null ? t.sucTemplate : t.rejTemplate, rows = avalcol.Value, sentonbehalf = configs.ContainsKey(EPconfigsEnum.sentonbehalf.ToString()) ? configs[EPconfigsEnum.sentonbehalf.ToString()] : null, ResultMap = t.ResultMap }); if (!success) { moveto = t.rejFolder; if (moveto == null) { clearCat = true; } } Logger.WriteToConsole($"Sending response template [{(success ? t.sucTemplate : t.rejTemplate)}] for [{subject.Subject}]"); } } else if (resultsCol?.Any() == true) { new EmailResponseController().execute(subject, new EmailResponseConfig() { oApp = oApp, template = configs.ContainsKey(EPconfigsEnum.sucTemplate.ToString()) ? new FileInfo(configs[EPconfigsEnum.sucTemplate.ToString()]) : null, sentonbehalf = configs.ContainsKey(EPconfigsEnum.sentonbehalf.ToString()) ? configs[EPconfigsEnum.sentonbehalf.ToString()] : null, savesentfolder = configs.ContainsKey(EPconfigsEnum.saveSentFolder.ToString()) ? configs[EPconfigsEnum.saveSentFolder.ToString()] : null }); Logger.WriteToConsole($"Sending response success template for [{subject.Subject}]"); } else if (success) { movetoinbox = true; Logger.WriteToConsole($"Moving to [{configs[EPconfigsEnum.retfolder.ToString()]}] due to having nothing to load..."); } else { Logger.WriteToConsole($"Unknown error occurred for [{subject.Subject}] ..."); } } } else { movetoinbox = true; } if (saveChanges) { if (movetoinbox) { clearCat = true; moveto = configs[EPconfigsEnum.retfolder.ToString()]; } if (clearCat) { subject.Categories = null; subject.Save(); } if (moveto != null && moveto != configs[EPconfigsEnum.destFolder.ToString()]) { var movetohandle = oApp.Session.Stores[configs[EPconfigsEnum.storename.ToString()]].GetRootFolder().Folders[moveto]; subject.Move(movetohandle); Marshal.ReleaseComObject(movetohandle); movetohandle = null; Logger.WriteToConsole($"Moved [{subject.Subject}] to [{moveto}]"); } } return(success); }
private void OutlookButton_Click(object sender, RoutedEventArgs e) { OutlookHelper.StartTracking(); }
/// <summary> /// Sets the last modification date of an appointment item /// </summary> /// <param name="item">The item</param> /// <param name="modDate">The modification date</param> public static void SetAppointmentModificationDate(this AppointmentItem item, DateTime modDate) { OutlookHelper.CreateOrGetProperty(item, Constants.FieldLastUpdate, OlUserPropertyType.olDateTime).Value = modDate; }