Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2005

Tip: Looking for answers? Try searching our database.

Accessing Addressbook from InfoPath

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cebess - 10 Mar 2005 14:06 GMT
I'd like to have the user enter personnel information using the Address book
dialog from outlook from within Infopath. I figured out how to do something
similar from LDAP, but most users are used to selecting people from outlook,
so I'd like to use that instead.

Unfortunately, all the examples I can find are in VB6, which are difficult
to implement from a .NET based language like C#, since I can't find all the
intervening class definitions.

Are there any good examples of accessing AddressBook from C# out there?
Thanks
cebess - 10 Mar 2005 18:36 GMT
Here is a console app that is much closer to what I was trying to do:
using System;

using MAPI;

namespace ConsoleApplicationOurlook

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Class1

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//

// TODO: Add code to start application here

//

MAPI.SessionClass oSession = new MAPI.SessionClass();

//oSession.Logon(System.Environment.UserName,
System.Reflection.Missing.Value, true, true,
System.Reflection.Missing.Value, false, System.Reflection.Missing.Value);

oSession.Logon(System.Reflection.Missing.Value,
System.Reflection.Missing.Value, true, false,
System.Reflection.Missing.Value,true, System.Reflection.Missing.Value);

MAPI.Recipients oRecipients = null;

MAPI.Recipient oRecipient = null;

MAPI.AddressEntry oAddressEntry = null;

//oRecipients =
(MAPI.Recipients)oSession.AddressBook(System.Reflection.Missing.Value,
"Select Name", true, true, -1, "", "", "", 0);

oRecipients =
(MAPI.Recipients)oSession.AddressBook(System.Reflection.Missing.Value,
"Select Name", true, true, -1, "", "", "", 0);

for(int i = 1; i <= (int)oRecipients.Count; i++)

{

// Do what you need with Recipient, or AddressEntry

oRecipient = (MAPI.Recipient)oRecipients.get_Item(i);

oAddressEntry = (MAPI.AddressEntry)oRecipient.AddressEntry;

string addressString = oAddressEntry.Address.ToString();

#if DEBUG

System.Console.WriteLine(addressString);

#endif

}

oSession.Logoff();

System.Console.ReadLine(); // wait to see what happens

}

}

}

> I'd like to have the user enter personnel information using the Address
> book dialog from outlook from within Infopath. I figured out how to do
[quoted text clipped - 7 lines]
> Are there any good examples of accessing AddressBook from C# out there?
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.