Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, I'm trying to make a Word template in visual studio 2012/C#, where I want to click a button which reads a cell in an MS word table (which contains a user name)and searches outlook for the Full name, phone and email for such user if it exists, and send it to different cells.

I added this to my document project:

C#
using Word = Microsoft.Office.Interop.Word;
using Outlook = Microsoft.Office.Interop.Outlook;


I'm not sure how to get the contact information that I want to display in various cells in my word document. Please advise.

Thanks.
Posted

1 solution

 
Share this answer
 
Comments
mcabel 23-May-13 14:16pm    
Hi, Thanks for your answer. I tried this and kinda works, but not completely and not as expected. I was only able to search in a limited number of contacts. Instead, I need to search and retrieve information from the whole contact list/global address list.

I found this http://msdn.microsoft.com/en-us/library/office/ff184631(v=office.14).aspx
but the example gives me an outlook pop up, but I want the search to be done "behind the scenes" and return a string array or list or table with the contact information or an empty structure if nothing is found.

Also I'm not sure what this means

" string PR_EMSMDB_SECTION_UID =
@"http://schemas.microsoft.com/mapi/proptag/0x3D150102";
if (store == null)"

I need code that works offline and regardless of microsoft changes, so if code is retrieved from a website, this would be inconvenient...

Please advise.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900