|
From: Cyrus on 14 Apr 2008 16:04 I am using C#.net on a Windows mobile device. I can get email addresses stored in my contacts, however, when I use the built in ContactDialog() window to select a user from the company exchange server, I have an error thrown. here is my code: It blows up when I try to access the information for the contact I pulled down from the server.... private void mnuSend_Click(object sender, EventArgs e) { EmailAccount MainAccount = AppSession.EmailAccounts[0]; EmailMessage myMsg = new EmailMessage(); ChooseContactDialog myContactDialog = new ChooseContactDialog(); string contactname, myAddress; Contact SelContact; myContactDialog.Title = "select user to send message:"; myMsg.CC.Add(new Recipient("first.last(a)company.com")); myMsg.Subject = "Test message from Mobile phone"; myMsg.BodyText = "This is the body of the message"; myContactDialog.EnableGlobalAddressListLookup = true; while ((myContactDialog.ShowDialog() == DialogResult.OK)) { contactname = myContactDialog.SelectedContactName; MessageBox.Show("Contactname=" + contactname); //This much works! SelContact = myContactDialog.SelectedContact; MessageBox.Show("About to try to access the Email1Address"); //The following line throws an exception MessageBox.Show("SelContact.email1address = " + SelContact.Email1Address); } MainAccount.Send(myMsg); MessageBox.Show("Message sent"); }
From: Peter Foot on 15 Apr 2008 10:21 Although it is not documented I found that the answer is to set the RequiredProperties of the ChooseContactDialog and as a result the specific property will be populated when the dialog successfully returns e.g. ccd.RequiredProperties = new ContactProperty[] { ContactProperty.AllEmail }; Peter -- Peter Foot Microsoft Device Application Development MVP www.peterfoot.net | www.inthehand.com In The Hand Ltd - .NET Solutions for Mobility "Cyrus" <nospam(a)nospam.com> wrote in message news:OoEODrmnIHA.4196(a)TK2MSFTNGP04.phx.gbl... >I am using C#.net on a Windows mobile device. I can get email addresses > stored in my contacts, however, when I use the built in ContactDialog() > window to select a user from the company exchange server, I have an error > thrown. > > here is my code: It blows up when I try to access the information for the > contact I pulled down from the server.... > private void mnuSend_Click(object sender, EventArgs e) > > { > > EmailAccount MainAccount = AppSession.EmailAccounts[0]; > > EmailMessage myMsg = new EmailMessage(); > > ChooseContactDialog myContactDialog = new ChooseContactDialog(); > > string contactname, myAddress; > > Contact SelContact; > > myContactDialog.Title = "select user to send message:"; > > > myMsg.CC.Add(new Recipient("first.last(a)company.com")); > > myMsg.Subject = "Test message from Mobile phone"; > > myMsg.BodyText = "This is the body of the message"; > > myContactDialog.EnableGlobalAddressListLookup = true; > > while ((myContactDialog.ShowDialog() == DialogResult.OK)) > > { > > contactname = myContactDialog.SelectedContactName; > > MessageBox.Show("Contactname=" + contactname); //This much works! > > SelContact = myContactDialog.SelectedContact; > > MessageBox.Show("About to try to access the Email1Address"); > > //The following line throws an exception > > MessageBox.Show("SelContact.email1address = " + SelContact.Email1Address); > > } > > MainAccount.Send(myMsg); > > MessageBox.Show("Message sent"); > > } > > > >
From: Cyrus on 17 Apr 2008 15:44 Peter, Thanks for the help. This was the information I needed. It works perfectly! Cyrus "Peter Foot" <feedback(a)nospam-inthehand.com> wrote in message news:765D370F-1102-4008-A5FB-99188A2E9D7D(a)microsoft.com... > Although it is not documented I found that the answer is to set the > RequiredProperties of the ChooseContactDialog and as a result the specific > property will be populated when the dialog successfully returns e.g. > > ccd.RequiredProperties = new ContactProperty[] { > ContactProperty.AllEmail }; > > Peter > > -- > Peter Foot > Microsoft Device Application Development MVP > www.peterfoot.net | www.inthehand.com > In The Hand Ltd - .NET Solutions for Mobility > > "Cyrus" <nospam(a)nospam.com> wrote in message > news:OoEODrmnIHA.4196(a)TK2MSFTNGP04.phx.gbl... >>I am using C#.net on a Windows mobile device. I can get email addresses >> stored in my contacts, however, when I use the built in ContactDialog() >> window to select a user from the company exchange server, I have an error >> thrown. >> >> here is my code: It blows up when I try to access the information for >> the >> contact I pulled down from the server.... >> private void mnuSend_Click(object sender, EventArgs e) >> >> { >> >> EmailAccount MainAccount = AppSession.EmailAccounts[0]; >> >> EmailMessage myMsg = new EmailMessage(); >> >> ChooseContactDialog myContactDialog = new ChooseContactDialog(); >> >> string contactname, myAddress; >> >> Contact SelContact; >> >> myContactDialog.Title = "select user to send message:"; >> >> >> myMsg.CC.Add(new Recipient("first.last(a)company.com")); >> >> myMsg.Subject = "Test message from Mobile phone"; >> >> myMsg.BodyText = "This is the body of the message"; >> >> myContactDialog.EnableGlobalAddressListLookup = true; >> >> while ((myContactDialog.ShowDialog() == DialogResult.OK)) >> >> { >> >> contactname = myContactDialog.SelectedContactName; >> >> MessageBox.Show("Contactname=" + contactname); //This much works! >> >> SelContact = myContactDialog.SelectedContact; >> >> MessageBox.Show("About to try to access the Email1Address"); >> >> //The following line throws an exception >> >> MessageBox.Show("SelContact.email1address = " + >> SelContact.Email1Address); >> >> } >> >> MainAccount.Send(myMsg); >> >> MessageBox.Show("Message sent"); >> >> } >> >> >> >> >
|
Pages: 1 Prev: Identifying music or video file being played Next: Windows CE cab file web deployment |