- How to access "Offline Address Book" (from exchange server/outlook configured to exchange machine) using Redemption (C#).
I am looking for some sample code to proceed with my task.
I am looking for some sample code to proceed with my task.
Sorry it's not much of an answer but I'd drop Dmitry Streblechenko (the developer of the Redemption library) an email - he's always been quick to respond and very helpful.
His email address is on the Redemption website: http://www.dimastr.com/redemption/
It would be helpful to be more specific in your question.
The "offline address book" is automatically managed by Outlook as a cached copy of the Global Address list of Exchange, see KB article.
If you need access to an element of the address book, use the SafeContact object from Redemption. The fact that Oulook cached the contact information should be transparent to the user.
There is not much to be done in the UI of Outlook regarding the offline address book. Does your question mean to programmatically trigger an update of the address book ? Like, in Outlook 2010, in the Send/Receive tab, Send & Receive group, Send/Receive Groups drop-down, download address book ?
Try this. I am using Redemption 4.6. I created a form and added a DataGridView for result viewing purpose. Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TestingJojoWinForms
{
public partial class frmRedemption : Form
{
public frmRedemption()
{
InitializeComponent();
}
private void frmRedemption_Load(object sender, EventArgs e)
{
DataTable dtResult = new DataTable("Result");
dtResult.Columns.Add("EntryID");
dtResult.Columns.Add("FirstName");
dtResult.Columns.Add("LastName");
dtResult.Columns.Add("Alias");
dtResult.Columns.Add("SMTPAddress");
dtResult.Columns.Add("JobTitle");
dtResult.Columns.Add("Address");
dtResult.Columns.Add("StreetAddress");
Redemption.RDOSessionClass session = new Redemption.RDOSessionClass();
session.Logon(@"your_account_name", "your_password", false, false, 0, false);
for(int index = 1; index <= session.AddressBook.GAL.AddressEntries.Count; index++)
{
Redemption.RDOAddressEntryClass entry = (Redemption.RDOAddressEntryClass)session.AddressBook.GAL.AddressEntries.Item(index);
dtResult.Rows.Add(entry.EntryID, entry.FirstName, entry.LastName, entry.Alias, entry.SMTPAddress, entry.JobTitle, entry.Address, entry.StreetAddress);
}
session.Logoff();
this.dataGridView1.DataSource = dtResult;
}
}
}
The result will be like this: