Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Can anyone suggest me how to connect to Exchange Server 2010(Client Access, Hub) and retrieve contacts from the Public folder. I have Exchange Server 2010 and I need to connect to Exchange Server via my asp.net/C# application and I am using EWS Managed API 2.0 to connect and retrieve contacts from Exchange 2010 public folder database.

Challenges are :
How can we retrieve custom contact fields using EWS API ?
Is there any way to achieve and retrieve custom fields that are already set inside the contacts of Exchange 2010 Public Folder Database.

It would be a great help if anyone could suggest me how to retrieve contacts & their custom fields which are not visible in OWA contact form of the Public folder in Exchange Server 2010.

Is there any workaround to achieve this functionality or any alternative way. Please suggest me?

Thanks.

What I have tried:

C#
string ExchangeContactFolder = Configuration.ExchangeContactFolder;
Folder ContactFolder = GetTopLevelFolder(_service, ExchangeContactFolder);
ItemView itemView = new ItemView(int.MaxValue);
FindItemsResults<Item> searchResults = _service.FindItems(ContactFolder.Id, itemView);
int totalContacts = searchResults.TotalCount;

//Setting properties for Custom Fields.

Guid FacebookGuid = new Guid("{a49b36f1-7895-4637-98ec-1ca35a345095}");
var FacebookAddress = new ExtendedPropertyDefinition(FacebookGuid, "Facebook", MapiPropertyType.String);

itemView.PropertySet = new PropertySet(BasePropertySet.IdOnly);
itemView.PropertySet.Add(FacebookAddress);

FindItemsResults<Item> contactItems = _service.FindItems(ContactFolder.Id, view);
                foreach (Item item in contactItems)
                {
                    if (item is Contact)
                    {
                        string strFacebookAddress = string.Empty;
			   contact.GetLoadedPropertyDefinitions();
               //item.TryGetProperty(FacebookAddress, out strFacebookAddress);
		       contact.TryGetProperty(FacebookAddress, out strFacebookAddress);
			   strContacts.Add(bcSearch);
                    }
                }
            }
            return strContacts; 
Posted

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