Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have done some programming to get contact from outlook. I am giving you some example code to help you up with this ..It is not excatly want you want but i think this will help you with your problem...</p> <pre><code> using System.Collections.Generic; // ... private List&lt;Outlook.ContactItem&gt; GetListOfContacts(Outlook._Application OutlookApp) { List&lt;Outlook.ContactItem&gt; contItemLst = null; Outlook.Items folderItems =null; Outlook.MAPIFolder mapiFoldSuggestedConts = null; Outlook.NameSpace nameSpc = null; Outlook.MAPIFolder mapiFoldrConts = null; object itemObj = null; try { contItemLst = new List&lt;Outlook.ContactItem&gt;(); nameSpc = OutlookApp.GetNamespace("MAPI"); // getting items from the Contacts folder in Outlook mapiFoldrConts = nameSpc.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); folderItems = mapiFoldrConts.Items; for (int i = 1; folderItems.Count &gt;= i; i++) { itemObj = folderItems[i]; if (itemObj is Outlook.ContactItem) contItemLst.Add(itemObj as Outlook.ContactItem); else Marshal.ReleaseComObject(itemObj); } Marshal.ReleaseComObject(folderItems); folderItems = null; // getting items from the Suggested Contacts folder in Outlook mapiFoldSuggestedConts = nameSpc.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderSuggestedContacts); folderItems = mapiFoldSuggestedConts.Items; for (int i = 1; folderItems.Count &gt;= i; i++) { itemObj = folderItems[i]; if (itemObj is Outlook.ContactItem) contItemLst.Add(itemObj as Outlook.ContactItem); else Marshal.ReleaseComObject(itemObj); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { if (folderItems != null) Marshal.ReleaseComObject(folderItems); if (mapiFoldrConts != null) Marshal.ReleaseComObject(mapiFoldrConts); if (mapiFoldSuggestedConts != null) Marshal.ReleaseComObject(mapiFoldSuggestedConts); if (nameSpc != null) Marshal.ReleaseComObject(nameSpc); } return contItemLst; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload