Question

As I mentioned in a former Question it is no problem to get shared contacts in Outlook via MAPI. But this is only possible, if you know the Users/Recipients sharing contacts (or also calendar) with the Current Outlook User.

Now back to my question: How can I get a list of Recipients sharing their contacts with me?

With the list I would do a foreach creating the Recipients and than access the shared folder.

// Get recipients    
IList<string> recipientsSharingContacts =  **???** ;

// Import/Read shared contacts 
foreach (string recip in recipientsSharingContacts){

    // Open Shared Folder
    MAPIFolder sharedContactsFolder = 
      Application.Session.GetSharedDefaultFolder(recip, OlDefaultFolders.olFolderContacts)

    // Import Contacts 
    ...

}

Hope someone can help me out.

Was it helpful?

Solution

If someone is interested in the solution, here is how I do it:

ContactsModule module = (ContactsModule)outlookObj.ActiveExplorer().NavigationPane.Modules.GetNavigationModule(OlNavigationModuleType.olModuleContacts);
foreach (NavigationGroup navigationGroup in module.NavigationGroups) {
     foreach (NavigationFolder navigationFolder in navigationGroup.NavigationFolders) {
          foreach (var item in navigationFolder.Folder.Items) {
                     // Found Folders are: Contacts, Suggested Contacts and Shared Contact Folders


                     // Import/Read ContactItems
                     ...
                }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top