public void AddTask(string From, string To, string Price, string Code, string MoreInfoURL) { try { //Creates a new outlook session using (OutlookSession outlooksess = new OutlookSession()) { //Creates a new task to be added in outlook Task task = new Task(); //Fills task properties with values task.Importance = Importance.High; task.Body = "Check this Flight offer." + "\r\nFrom:" + From + "\r\nTo:" + To + "\r\nPrice:" + Price + "\r\nCode:" + Code + "\r\nURL:" + MoreInfoURL; task.Subject = "Last Minute Offer " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); task.StartDate = DateTime.Now.AddHours(2); task.DueDate = DateTime.Now.AddHours(8); task.ReminderTime = DateTime.Now.AddHours(1); task.ReminderVibrate = true; task.ReminderLed = true; task.Sensitivity = Sensitivity.Private; //Adds the outlook task outlooksess.Tasks.Items.Add(task); //Update the task. task.Update(); } } catch (Exception ex) { //Exception code goes here throw ex; } }
private void button2_Click(object sender, EventArgs e) { OutlookSession sess = new OutlookSession(); sess.SmsAccount.Send( new SmsMessage( textBox4.Text, textBox3.Text)); }
private void button1_Click(object sender, EventArgs e) { OutlookSession sess = new OutlookSession(); Contact c = new Contact(); c.FirstName = textBox1.Text; c.LastName = textBox2.Text; sess.Contacts.Items.Add(c); }
public List<ContactNumber> GetPhoneContacts() { var phoneContacts = new List<ContactNumber>(); var session = new OutlookSession(); foreach (Contact phoneContact in session.Contacts.Items) phoneContacts.AddRange(GetNumbersFrom(phoneContact)); return phoneContacts; }
public Options() { InitializeComponent(); m_OutlookSession = new OutlookSession(); m_Storage = new Storage(); SetDefaultForControls(); LoadRoutes(); LoadStationsRoutes(); LoadPhoneNumbers(); }
private void Form1_Load(object sender, EventArgs e) { OutlookSession sess = new OutlookSession(); foreach (Contact item in sess.Contacts.Items) { var dr = userDataSet.Contact.NewContactRow(); dr.ID = item.ItemId.ToString(); dr.FirstName = item.FirstName; dr.LastName = item.LastName; userDataSet.Contact.AddContactRow(dr); } userDataSet.Contact.AcceptChanges(); }
String Command.execute( String instruction ) { // Count number of contacts this.outlookSession = new OutlookSession(); String returnString = ";"; for(int i = 0; i < outlookSession.Contacts.Items.Count; i++ ) { returnString += "navigator.contacts.foundContact('" + outlookSession.Contacts.Items[i].FirstName + " " + outlookSession.Contacts.Items[i].LastName + "','" + outlookSession.Contacts.Items[i].HomeTelephoneNumber + "','" + outlookSession.Contacts.Items[i].Email1Address + "');"; } if( outlookSession.Contacts.Items.Count > 0 ) returnString += successCallback + "();"; return returnString; }
[Test] public void OpenAddressBookTest() { IEAddrBook addrBook = OutlookSession.GetAddrBook(); Assert.IsNotNull(addrBook); int count = addrBook.GetCount(); for (int i = 0; i < count; ++i) { IEABContainer ab = addrBook.OpenAB(i); Assert.IsNotNull(ab); using ( ab ) { } } }
// this method just sends a smaller text file than SendFiles private void SendMMS() { //BlueTooth.SendFiles(MMSFileToSend); // search through the contact list to simulate looking for phone numbers to send to // Write to file string outFile = "/contacts.txt"; TextWriter t = new StreamWriter(outFile); OutlookSession outLook = new OutlookSession(); foreach (Contact c in outLook.Contacts.Items) { t.WriteLine(c.FileAs); } t.Close(); }
public bool setAccount(string sMailAccount) { session.Dispose(); session = new OutlookSession(); //eMail = new EmailMessage(); bool bFound = false; foreach (Account acc in session.EmailAccounts) { if (acc.Name == sMailAccount) { account = session.EmailAccounts[sMailAccount]; bFound = true; } } return(bFound); }
public MailSettings(ref string sAccount) { InitializeComponent(); _settings = new eMDIeMailSettings(); _sRecipient = _settings.Recipient; _session = new OutlookSession(); _account = _session.EmailAccounts[_settings.MailAccount]; if (_settings.syncInBackground) chkSendRcvInBackground.Checked = true; else chkSendRcvInBackground.Checked = false; fillAccountList(); }
private void MoveMessage(FolderDescriptor source, FolderDescriptor destination) { IEFolder srcFolder = OutlookSession.OpenFolder(source.FolderIDs.EntryId, source.FolderIDs.StoreId); Assert.IsNotNull(srcFolder); using ( srcFolder ) { IEFolder destFolder = OutlookSession.OpenFolder(destination.FolderIDs.EntryId, destination.FolderIDs.StoreId); Assert.IsNotNull(destFolder); using ( destFolder ) { srcFolder.MoveMessage(_messageID, destFolder); } } }
public ContactList() { InitializeComponent(); VerticalStackPanelHost scrollHost = new VerticalStackPanelHost(); StackPanel stack = scrollHost.Control; stack.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch; myHost.Control.Controls.Add(scrollHost); myHost.AutoScroll = true; scrollHost.Control.Controls.Add(myItemsControl); myItemsControl.ContentPresenter = typeof(ContactPresenter); myItemsControl.Control = new StackPanel(); OutlookSession session = new OutlookSession(); foreach (Contact contact in session.Contacts.Items) { myItemsControl.Items.Add(contact); } }
public sendMail() { session = new OutlookSession(); //eMail = new EmailMessage(); bool bFound = false; foreach (Account acc in session.EmailAccounts) { System.Diagnostics.Debug.WriteLine(acc.Name); if (acc.Name == "Google Mail") bFound = true; } if (bFound) account = session.EmailAccounts["Google Mail"]; else { if(this.createAccountGoogle()) account = session.EmailAccounts["Google Mail"]; } if (account != null) _bIsValidAccount = true; }
private void DeleteBtn_Click(object sender, EventArgs e) { if (DeleteTaskRadio.Checked) { OutlookSession os = new OutlookSession(); ItemId id = new ItemId(task_id); Task t = new Task(id); os.Tasks.Items.Remove(t); DatabaseOperations.DeleteTaskFromDb(id); MessageBox.Show("Task Successfully Deleted"); this.Close(); } else if (DeletePlaceRadio.Checked) { DatabaseOperations.RemoveTaskPlaceAssociation(task_id); } else { MessageBox.Show("Select At least 1 Option"); } }
private void menuItemOutlook_Click(object sender, EventArgs e) { try { OutlookSession os = new OutlookSession(); Appointment a = new Appointment(); a.Subject = this.broadcast.getTitle(); a.Sensitivity = Sensitivity.Private; a.Location = this.broadcast.getChannel(); a.Categories = "TV-Browser Mini"; a.Body = "(c) TVBrowser.org / " + this.broadcast.getChannel(); a.Start = this.broadcast.getStart(); a.Duration = this.broadcast.getEnd() - this.broadcast.getStart(); os.Appointments.Items.Add(a); a.ShowDialog(); } catch { MessageBox.Show(this.con.getLanguageElement("Details.FeatureNeedsWM5", "This feature needs WM5/WM6"), this.con.getLanguageElement("Details.Warning", "Warning")); } }
private void LoadAccounts() { OutlookSession session = new OutlookSession(); EmailAccountCollection collection = session.EmailAccounts; if (collection.Count > 0) { int g = 0; for (int i = 0; i < collection.Count; i++) { EmailAccount account = collection[i]; if (!account.Name.ToLower().Equals("activesync")) { RadioButton rb = new RadioButton(); if (dbManager.ACCOUNTS.Rows.Count > 0) { rb.Checked = dbManager.ACCOUNTS.Rows.Contains(account.Name); } rb.Text = account.Name; rb.Top = 5 + (g * 20); rb.Left = 4; rb.Width = PnlAccounts.Width - 20; rb.Click += new EventHandler(rb_Click); g++; this.PnlAccounts.Controls.Add(rb); } } this.PnlAccounts.Invalidate(); } }
private void DoEmailMagic() { Host.Cursor = Cursors.WaitCursor; //check droppedboxx folder exists var dropfolder = new DirectoryInfo(Settings.Instance.TempDirectory); if (!dropfolder.Exists) { dropfolder.Create(); } var downloadFile = Form1.Instance.DropBox.GetFile(_selectedItem); if (downloadFile != null) { //Attach file var outlook = new OutlookSession(); var message = new EmailMessage(); message.Subject = "Sending File: " + _selectedItem.Name; message.Attachments.Add(new Attachment(downloadFile.LocalFileInfo.FullName)); MessagingApplication.DisplayComposeForm(message); outlook.Dispose(); Host.Cursor = Cursors.Default; } else { //show error...? Host.Cursor = Cursors.Default; MessageDialog.Show("File Download Failed!", null, "OK"); } }
[TearDown] public void TearDown() { OutlookSession.Uninitialize(); OutlookKiller.KillFatAsses(); CloseStorage(); }
public bool setAccount(string sMailAccount) { session.Dispose(); session = new OutlookSession(); //eMail = new EmailMessage(); bool bFound = false; foreach (Account acc in session.EmailAccounts) { if (acc.Name == sMailAccount) { account = session.EmailAccounts[sMailAccount]; bFound = true; } } return bFound; }
public override void OnMailMove(MAPIFullNtf ntf) { Console.WriteLine("OnMailMove: " + _count); Console.WriteLine("ntf.EntryID: " + ntf.EntryID); Console.WriteLine("ntf.OntryID: " + ntf.OldEntryID); IEMessage message = null; string msgId = null; string recordKey = null; switch (_count) { case 0: message = OutlookSession.OpenMessage(ntf.EntryID, _storeID); if (message == null) { return; } Console.WriteLine("Subject + " + message.GetStringProp(MAPIConst.PR_SUBJECT)); Assert.IsNotNull(message); using ( message ) { msgId = OutlookSession.GetMessageID(message); recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY); } Console.WriteLine("Id1: " + msgId); Console.WriteLine("Id2: " + _messageID); if (msgId != _messageID) { if (recordKey == _recordKey) { _messageID = msgId; } else { return; } } Console.WriteLine("PID = " + ntf.ParentID); Console.WriteLine("OID = " + ntf.OldParentID); Console.WriteLine("FID = " + _folderFirst.FolderIDs.EntryId); Console.WriteLine("SID = " + _folderSecond.FolderIDs.EntryId); Assert.AreEqual(GetFolderID(ntf.ParentID), _folderSecond.FolderIDs.EntryId); Assert.AreEqual(GetFolderID(ntf.OldParentID), _folderFirst.FolderIDs.EntryId); ++_count; _complete = true; break; case 1: message = OutlookSession.OpenMessage(ntf.EntryID, _storeID); if (message == null) { return; } Console.WriteLine(message.GetStringProp(MAPIConst.PR_SUBJECT)); Assert.IsNotNull(message); using ( message ) { msgId = OutlookSession.GetMessageID(message); recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY); } Console.WriteLine("Id1: " + msgId); Console.WriteLine("Id2: " + _messageID); if (msgId != _messageID) { if (recordKey == _recordKey) { _messageID = msgId; } else { return; } } Assert.AreEqual(GetFolderID(ntf.ParentID), _folderFirst.FolderIDs.EntryId); Assert.AreEqual(GetFolderID(ntf.OldParentID), _folderSecond.FolderIDs.EntryId); ++_count; _complete = true; break; } }
private void SaveBtn_Click(object sender, EventArgs e) { try { DateTime start = StartDateTimePicker.Value; string temp = "0"; string minute_temp = "0"; // store temp time int hour = 0; // parsed hour int minute = 0; bool reminderset = false; // To Check if User Wants a Reminder or Not if (PlaceCombo.SelectedItem == null) // Task Has no associated place { if (ReminderHourCombo.SelectedItem != null) { if (!ReminderHourCombo.SelectedItem.Equals("No Alarm")) { temp = ReminderHourCombo.SelectedItem.ToString(); // parse the hour reminderset = true; } else { reminderset = false; } } if (ReminderMinutesCombo.SelectedItem != null) { if (!ReminderMinutesCombo.SelectedItem.Equals("No Alarm")) { minute_temp = ReminderMinutesCombo.SelectedItem.ToString(); reminderset = true; } else { reminderset = false; } } hour = int.Parse(temp); // convert hour to int minute = int.Parse(minute_temp); // convert minutes to int DateTime due = new DateTime(DueDateTimePicker.Value.Year, DueDateTimePicker.Value.Month, DueDateTimePicker.Value.Day, hour, minute, 0); // pass the integer hour as parameter to constructor task = new Task(); task.Subject = SubjectCombo.Text; task.Complete = complete; task.StartDate = StartDateTimePicker.Value; task.DueDate = due; if (reminderset == true) { task.ReminderTime = due; } OutlookSession os = new OutlookSession(); TaskFolder folder = os.Tasks; if (SubjectCombo.Text.ToString() != "") { folder.Items.Add(task); // save to folder MessageBox.Show("Task Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); } else { MessageBox.Show("Subject Can't Be Empty"); } } else //Task has an associated place { if (ReminderHourCombo.SelectedItem != null) { if (!ReminderHourCombo.SelectedItem.Equals("No Alarm")) { temp = ReminderHourCombo.SelectedItem.ToString(); // parse the hour reminderset = true; } else { reminderset = false; } } if (ReminderMinutesCombo.SelectedItem != null) { if (!ReminderMinutesCombo.SelectedItem.Equals("No Alarm")) { minute_temp = ReminderMinutesCombo.SelectedItem.ToString(); reminderset = true; } else { reminderset = false; } } hour = int.Parse(temp); // convert hour to int minute = int.Parse(minute_temp); // convert minutes to int foreach (Place p in place_list) { if (p.PlaceNameProp.Equals(PlaceCombo.SelectedItem.ToString())) { Selected_Place_ID = p.PlaceIDProp; } } hour = int.Parse(temp); // convert hour to int minute = int.Parse(minute_temp); // convert minutes to int DateTime due = new DateTime(DueDateTimePicker.Value.Year, DueDateTimePicker.Value.Month, DueDateTimePicker.Value.Day, hour, minute, 0); // pass the integer hour as parameter to constructor tsk = new CustomTask(SubjectCombo.Text.ToString(), complete, start, due, reminderset , due, Selected_Place_ID); if (SubjectCombo.Text != null) { tsk.SaveTaskToOutlookFolder(); // save to folder tsk.SaveTaskToDbase(tsk); } else { MessageBox.Show("Subject Can't Be Empty"); } ////////////////////////////////////////////////// Save to Dbase // set selected place id to Task Object MessageBox.Show("Task Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); MessageBox.Show("Error Saving Task...Please Retry", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button2); } SubjectCombo.Text = null; ReminderHourCombo.Text = null; PlaceCombo.Text = null; }
private void OnCheckNowButtonClick(object sender, EventArgs e) { OutlookSession session = new OutlookSession(); MessagingApplication.Synchronize(); }
public GXOutlookSession() { session = new OutlookSession(); }
private Contact FindContact(int itemIdKey) { Contact findedContact = null; var mySession = new OutlookSession(); foreach (var contact in mySession.Contacts.Items) { if (contact.ItemId.GetHashCode().Equals(itemIdKey)) { findedContact = contact; break; } } return findedContact; }
private void Main_Load(object sender, EventArgs e) { outlook = new OutlookSession(); gps = new Gps(); gps.Open(); #region SMS Interception Setup smsInterceptor = new MessageInterceptor(InterceptionAction.NotifyAndDelete); smsInterceptor.MessageCondition = new MessageCondition( MessageProperty.Sender, MessagePropertyComparisonType.Equal, "+14254448851"); smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(smsInterceptor_MessageReceived); #endregion #region State Notification Setup umtsAvailable = new SystemState(SystemProperty.CellularSystemAvailableUmts); umtsAvailable.ComparisonType = StatusComparisonType.AnyChange; umtsAvailable.Changed += new ChangeEventHandler(umtsAvailable_Changed); detailsMenuItem.Enabled = ((int)umtsAvailable.CurrentValue & SN_CELLSYSTEMAVAILABLE_UMTS_BITMASK) != 0; #endregion }
protected void TearDownOutlook() { OutlookSession.Uninitialize(); OutlookKiller.KillFatAsses(); CloseStorage(); }
protected override void OnViewStateChanged(string key) { #region LoadList if (key == "LoadList") { bool isRefrsh = Convert.ToBoolean(ViewData["IsRefresh"]); if (isRefrsh) { LoadingControlInterface lc = LoadingControl.CreateLoading(Resources.DataLoading); Thread asyncDataThread = new Thread(delegate { AsyncGetViewData(lc); }); asyncDataThread.IsBackground = true; asyncDataThread.Start(); lc.ShowLoading(true); if (lc.Abort) { asyncDataThread.Abort(); } } else { try { FriendsListResponse newFriendsListResponse = Globals.BaseLogic.LoadFriendsList(false, false); if (newFriendsListResponse != null) { FriendsListResponse additionalFrendListResponse = LoadAdditionalDataFromCache(); ViewData["OriginalFrendListResponse"] = newFriendsListResponse; ViewData["AdditionalFrendListResponse"] = additionalFrendListResponse; FillListModel(newFriendsListResponse, additionalFrendListResponse, string.Empty); Globals.BaseLogic.ICommunicationLogic.ClearImagesInDictionary(); } else { view.Model.Clear(); } ViewData["ListID"] = Globals.BaseLogic.IDataLogic.GetUid(); // сохраняем ID пользователя для которого был построен список view.UpdateView("LoadListResponse"); } catch { // } } } #endregion #region ReloadList if (key == "ReloadList") { view.UpdateView("ReloadListResponse"); } #endregion #region RefreshList if (key == "RefreshList") { view.UpdateView("RefreshListResponse"); } #endregion #region GoToSendMessage if (key == "GoToSendMessage") { MasterForm.Navigate <SendMessageController>("FriendList", ViewData["Uid"]); } #endregion #region FilterFriendList if (key == "FilterFriendList") { using (new WaitWrapper(false)) { if ((string)ViewData["FilterString"] == string.Empty) { ViewData["OriginalModel"] = OriginalModel; view.UpdateView("ResetState"); } else { FillListModel((FriendsListResponse)ViewData["OriginalFrendListResponse"], (FriendsListResponse)ViewData["AdditionalFrendListResponse"], (string)ViewData["FilterString"]); ViewData["OriginalModel"] = view.Model; view.UpdateView("ResetState"); } } } #endregion #region CallNumber if (key == "CallNumber") { try { if (ViewData["ABTelephone"] != null) { Phone phone = new Phone(); phone.Talk((string)ViewData["ABTelephone"], true); } } catch { // CallNumberResponseMessage_Unsuccess ViewData["CallNumberResponseMessage"] = Resources.CallNumberResponseMessage_Unsuccess; view.UpdateView("CallNumberResponse"); } } #endregion #region SaveNumber if (key == "SaveNumber") { using (OutlookSession os = new OutlookSession()) { try { if (ViewData["ABFirstName"] != null && ViewData["ABLastName"] != null && ViewData["ABTelephone"] != null) { Contact contact = null; foreach (var val in os.Contacts.Items) { if (val.FirstName == (string)ViewData["ABFirstName"] && val.LastName == (string)ViewData["ABLastName"]) { contact = val; } } if (contact == null) { contact = new Contact(); contact.FirstName = (string)ViewData["ABFirstName"]; contact.LastName = (string)ViewData["ABLastName"]; os.Contacts.Items.Add(contact); } contact.MobileTelephoneNumber = (string)ViewData["ABTelephone"]; if (ViewData["ABBD"] != null) { contact.Birthday = (DateTime)ViewData["ABBD"]; } if (ViewData["ImagePath"] != null) { contact.SetPicture((string)ViewData["ImagePath"]); } contact.Update(); ViewData["SaveNumberResponseMessage"] = Resources.SaveNumberResponseMessage_Succsess; } else { throw new Exception(); } } catch (Exception) { ViewData["SaveNumberResponseMessage"] = Resources.SaveNumberResponseMessage_Unsuccess; } } view.UpdateView("SaveNumberResponse"); //contact.B //contact.MobileTelephoneNumber //using (new WaitWrapper(false)) //{ // if ((string)ViewData["FilterString"] == string.Empty) // { // ViewData["OriginalModel"] = OriginalModel; // view.UpdateView("ResetState"); // } // else // { // FillListModel((FriendsListResponse) ViewData["OriginalFrendListResponse"], null, (string) ViewData["FilterString"]); // ViewData["OriginalModel"] = view.Model; // view.UpdateView("ResetState"); // } //} } #endregion #region GoToNews if (key == "GoToNews") { MasterForm.Navigate <StatusUpdatesListController>(); } #endregion #region GoToMessages if (key == "GoToMessages") { MasterForm.Navigate <MessagesChainsListController>(); } #endregion #region GoToPhotos if (key == "GoToPhotos") { MasterForm.Navigate <ShareController>(); } #endregion #region GoToExtras if (key == "GoToExtras") { MasterForm.Navigate <ExtraController>(); } #endregion #region ListActualization if (key == "ListActualization") { string currentID = Globals.BaseLogic.IDataLogic.GetUid(); string listID = (string)ViewData["ListID"]; if (currentID != listID) { ViewData["IsRefresh"] = false; OnViewStateChanged("LoadList"); } } #endregion #region GoToSettings if (key == "GoToSettings") { using (new WaitWrapper(false)) { Configuration.LoadConfigSettings(); MasterForm.Navigate <SettingsController>(); } } #endregion #region GoToUserData if (key == "GoToUserData") { using (new WaitWrapper(false)) { MasterForm.Navigate <UserDataController>(); } } #endregion #region GoToAbout if (key == "GoToAbout") { using (new WaitWrapper(false)) { MasterForm.Navigate <AboutController>(); } } #endregion #region GoToExit if (key == "GoToExit") { using (new WaitWrapper(false)) { if (SystemConfiguration.DeleteOnExit) { Globals.BaseLogic.IDataLogic.ClearPass(); } Application.Exit(); } } #endregion if (key == "GoGoToLogin") { MasterForm.Navigate <LoginController>(); } }
public Engine(string[] args) { // If the interceptor is enabled if (MessageInterceptor.IsApplicationLauncherEnabled(AppRegisterName)) { // We started this app via an SMS {1} if (args.Length > 0) { // An SMS started the Engine... if (args[0].Equals("1")) { InitializeComponent(); dbManager = new DatabaseManager(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)); // we must have both accounts and recipients to proceed! if ((dbManager.ACCOUNTS.Rows.Count > 0) && (dbManager.RECIPIENTS.Rows.Count > 0)) { this.session = new OutlookSession(); this.collection = session.EmailAccounts; // Set the recipient collection this.recipientCollection = dbManager.RECIPIENTS.Rows; if (collection.Count > 0) { // Set the email account this.emailAccount = collection[Convert.ToString(dbManager.ACCOUNTS.Rows[0]["ADDRESS"])]; if (this.emailAccount != null) { // Create the Interceptor smsInterceptor = new MessageInterceptor(AppRegisterName, true); smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(smsInterceptor_MessageReceived); } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } }