![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
1. retrieve addresses from emails
From an individual e-mail, use Item.SenderEmailAddress. To retrieve from all e-mails, loop through the MAPIFolder.Items collection for the folder you want to inspect 2. Check for the address in the contacts list Use a loop through the Items collection from the Contacts folder. Use Items.Restrict("[Email1Address = '") to filter the collection. Repeat with Email2Address and Email3Address. OR - use Redemption (www.dimastr.com) - which has a handy RDOAddressEntry.GetContact method. 3. run a form that will prompt "would you like to add as contact" You don't need to design a form for this, unless you really need to customize the dialog. Use the MsgBox method. 4. when you click yes, opens the standard "add contact" form with the email already filled out (this one is optional) Use something like: Set objContact = olApp.CreateItem(olContactItem) objContact.Email1Address = strEmail objContact.Display -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "BrianL" wrote: I have found this post to be very helpful to me as I try to write a script for an employee. I havn't done any VB coding since I was 12 however and I'm a bit rusty (I'm fixing that by reading VBA in a Nutshell) A couple days ago an employee asked if there was a way to get Outlook to prompt you when you recieve an e-mail from someone who is not in your contact list. We downloaded an add-on that adds contacts from all messages sent and recieved, but it hasn't worked out to well. My Goal for this script: 1. retrieve addresses from emails 2. Check for the address in the contacts list 3. run a form that will prompt "would you like to add as contact" 4. when you click yes, opens the standard "add contact" form with the email already filled out (this one is optional) I already have the Prompt form created and have named it addprompt. The only script I have right now is the script for the "no" button. any advice on how to achieve my goal would be greatly apreciated |
#2
|
|||
|
|||
![]()
I did not realize it, but I have this question twice in the newsgroup haha.
Sue M. gave me the idea to make the first steps more simple: just have a rule that applies to every message, and make an exception for emails sent by a contact. If it isn't in the contact list, then I will run the msgbox / script to actually add the contact. We havn't completely finished discusing it, but the code you provided will give me good ground to build on. I really appreciate your input here =]. "Eric Legault [MVP - Outlook]" wrote: 1. retrieve addresses from emails From an individual e-mail, use Item.SenderEmailAddress. To retrieve from all e-mails, loop through the MAPIFolder.Items collection for the folder you want to inspect 2. Check for the address in the contacts list Use a loop through the Items collection from the Contacts folder. Use Items.Restrict("[Email1Address = '") to filter the collection. Repeat with Email2Address and Email3Address. OR - use Redemption (www.dimastr.com) - which has a handy RDOAddressEntry.GetContact method. 3. run a form that will prompt "would you like to add as contact" You don't need to design a form for this, unless you really need to customize the dialog. Use the MsgBox method. 4. when you click yes, opens the standard "add contact" form with the email already filled out (this one is optional) Use something like: Set objContact = olApp.CreateItem(olContactItem) objContact.Email1Address = strEmail objContact.Display -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ |
#3
|
|||
|
|||
![]()
Right, if you use those rule condition/exceptions, you won't have to do Step #2 at all.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "BrianL" wrote in message ... I did not realize it, but I have this question twice in the newsgroup haha. Sue M. gave me the idea to make the first steps more simple: just have a rule that applies to every message, and make an exception for emails sent by a contact. If it isn't in the contact list, then I will run the msgbox / script to actually add the contact. We havn't completely finished discusing it, but the code you provided will give me good ground to build on. I really appreciate your input here =]. "Eric Legault [MVP - Outlook]" wrote: 1. retrieve addresses from emails From an individual e-mail, use Item.SenderEmailAddress. To retrieve from all e-mails, loop through the MAPIFolder.Items collection for the folder you want to inspect 2. Check for the address in the contacts list Use a loop through the Items collection from the Contacts folder. Use Items.Restrict("[Email1Address = '") to filter the collection. Repeat with Email2Address and Email3Address. OR - use Redemption (www.dimastr.com) - which has a handy RDOAddressEntry.GetContact method. 3. run a form that will prompt "would you like to add as contact" You don't need to design a form for this, unless you really need to customize the dialog. Use the MsgBox method. 4. when you click yes, opens the standard "add contact" form with the email already filled out (this one is optional) Use something like: Set objContact = olApp.CreateItem(olContactItem) objContact.Email1Address = strEmail objContact.Display -- Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ |
#4
|
|||
|
|||
![]()
Thanks for all of your help here guys. The code that Eric gave me and the new
approach Sue contributed will help me greatly. I would sit here and ask you to hold my hand through writing this code, but where's the accomplishment in that? haha Thanks again, Brian L (the 16 year old programmer :-P ) "Sue Mosher [MVP-Outlook]" wrote: Right, if you use those rule condition/exceptions, you won't have to do Step #2 at all. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
#5
|
|||
|
|||
![]()
actually, lets not close this one just yet.
I have written the code for the form I created. However, I do not know how to run the from using a rule. and I don't know how to save a script that would open the form. Advice? Please and thankyou, Brian |
#6
|
|||
|
|||
![]()
The "run a script" rule action in the Rules Wizard will give you an underlined link to click to choose the "script," which is actually the procedure you wrote in VBA, not a separate file.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "BrianL" wrote in message ... actually, lets not close this one just yet. I have written the code for the form I created. However, I do not know how to run the from using a rule. and I don't know how to save a script that would open the form. Advice? Please and thankyou, Brian |
#7
|
|||
|
|||
![]()
We'll be here if you get stumped, Brian. Have fun.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "BrianL" wrote in message ... Thanks for all of your help here guys. The code that Eric gave me and the new approach Sue contributed will help me greatly. I would sit here and ask you to hold my hand through writing this code, but where's the accomplishment in that? haha Thanks again, Brian L (the 16 year old programmer :-P ) "Sue Mosher [MVP-Outlook]" wrote: Right, if you use those rule condition/exceptions, you won't have to do Step #2 at all. |
#8
|
|||
|
|||
![]()
actually, I just posted a problem I found.
I have successfully written the code for my form. However, I do not know how to write a script or custom action that will open the form. I think the bigger problem is that I do not know how to save the script or action for use in a rule. "Sue Mosher [MVP-Outlook]" wrote: We'll be here if you get stumped, Brian. Have fun. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
#9
|
|||
|
|||
![]() Hi, I need to fetch my outlook contacts in a csv file using c#. I am able to do it by writing all the fields one by one in my data.csv. e.g. for (int i = 1; i = contactFld.Items.Count ; i++) { Outlook.ContactItem contact = (Outlook.ContactItem)contactFld.ItemsIdea; if (contact.Email1Address != null || contact.Email2Address != null || contact.Email3Address != null) { try { sw.Write(contact.FirstName); sw.Write("',"); sw.Write(contact.LastName); sw.Write("',"); sw.WriteLine(contact.Email1Address); } catch (Exception e1) { MessageBox.Show("Error"); } } } Now, instead of creating this .csv file, I want to fetch the .csv file diretly. Is there any method to fetch it directly from MAPIFolder element? Or any other way.. "BrianL" wrote: Thanks for all of your help here guys. The code that Eric gave me and the new approach Sue contributed will help me greatly. I would sit here and ask you to hold my hand through writing this code, but where's the accomplishment in that? haha Thanks again, Brian L (the 16 year old programmer :-P ) "Sue Mosher [MVP-Outlook]" wrote: Right, if you use those rule condition/exceptions, you won't have to do Step #2 at all. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
#10
|
|||
|
|||
![]()
No, there aren't any built-in methods for importing (or exporting) to a CSV
file, you have to write your own code for that. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "satishsuman" wrote in message ... Hi, I need to fetch my outlook contacts in a csv file using c#. I am able to do it by writing all the fields one by one in my data.csv. e.g. for (int i = 1; i = contactFld.Items.Count ; i++) { Outlook.ContactItem contact = (Outlook.ContactItem)contactFld.ItemsIdea; if (contact.Email1Address != null || contact.Email2Address != null || contact.Email3Address != null) { try { sw.Write(contact.FirstName); sw.Write("',"); sw.Write(contact.LastName); sw.Write("',"); sw.WriteLine(contact.Email1Address); } catch (Exception e1) { MessageBox.Show("Error"); } } } Now, instead of creating this .csv file, I want to fetch the .csv file diretly. Is there any method to fetch it directly from MAPIFolder element? Or any other way.. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exporting appts from another program | Feene | Outlook - Calandaring | 1 | March 8th 06 09:06 PM |
My program runs very slow | קובץ | Outlook and VBA | 6 | January 22nd 06 04:46 PM |
Open program with ... | Ann | Outlook Express | 3 | January 18th 06 06:24 PM |
How to Program a Calendar Control | Chaplain Doug | Outlook - Using Forms | 1 | January 12th 06 03:53 PM |
Address book program with CRM features to replace Outlook/Express contact book | [email protected] | Outlook - Using Contacts | 0 | January 11th 06 12:36 AM |