public void CreateOutlookContact(string fName = "", string lName = "", string email = "", string address = "", string phone = "") { Microsoft.Office.Interop.Outlook.Application outlookObj = new Microsoft.Office.Interop.Outlook.Application(); ContactItem contact = (ContactItem)outlookObj.CreateItem(OlItemType.olContactItem); try { contact.FirstName = fName; contact.LastName = lName; contact.Email1Address = email; contact.HomeAddress = address; contact.HomeTelephoneNumber = phone; contact.Save(); } catch { InformationBox.Show("Error saving Outlook contact", "Outlook Error"); } }
public void SyncWithOutlook() { this.Parent.Enabled = false; string[] info = new string[4]; if (Interpolation.outlookContacts.Count > 0) { foreach (ContactItem c in Interpolation.outlookContacts) { info[0] = ((c.FirstName != null) ? c.FirstName : "") + " " + ((c.LastName != null) ? c.LastName : ""); info[1] = (c.Email1Address != null ? c.Email1Address : ""); info[2] = (c.HomeAddress != null ? c.HomeAddress : ""); info[3] = (c.HomeTelephoneNumber != null ? c.HomeTelephoneNumber : ""); bool exists = false; foreach (DataGridViewRow row in this.Rows) { string name = ((row.Cells[0].Value) == null) ? "" : row.Cells[0].Value.ToString(); string email = ((row.Cells[1].Value) == null) ? "" : row.Cells[1].Value.ToString(); string address = ((row.Cells[2].Value) == null) ? "" : row.Cells[2].Value.ToString(); string phone = ((row.Cells[3].Value) == null) ? "" : row.Cells[3].Value.ToString(); if (info[0] == name && info[1] == email && info[2] == address && info[3] == phone) { exists = true; break; } } if (!exists) { this.Rows.Add(info); } } } else { InformationBox.Show("Either you don't have Outlook installed, or you don't have any contacts", "No Outlook Contacts Found"); } this.Parent.Enabled = true; }
public void Export(string notes) { try { Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application(); object missing = System.Reflection.Missing.Value; object fileName = "normal.dot"; object newTemplate = false; object docType = 0; object isVisible = true; Document aDoc = WordApp.Documents.Add(ref fileName, ref newTemplate, ref docType, ref isVisible); WordApp.Visible = true; aDoc.Activate(); WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter; WordApp.Selection.Font.Bold = (int)Microsoft.Office.Interop.Word.WdConstants.wdToggle; WordApp.Selection.TypeText(notes); } catch { InformationBox.Show("Your document will be exported to your default text editor", "Microsoft Word not found"); File.WriteAllText("note_expot.txt", notes); Process.Start("note_expot.txt"); } }
private void btnDetails_Click_1(object sender, EventArgs e) { InformationBox.Show(description + "\r\n" + "\r\nNew Version: " + version + "\r\n" + "\r\nFeatures:" + features, "Update Details"); }
private void btnYes_Click_1(object sender, EventArgs e) { InformationBox.Show("All application processes will be closed\r\n", "Update"); System.Diagnostics.Process.Start(host); NotesProgram.exit = true; }