How to add contacts to All Contacts in directories

Hi,

     I are trying to add contacts and want to show it on all contacts folder in left navigation directory panel. I have used the following code.

try
            {
                ExchangeService Exchageser = new ExchangeService(ExchangeVersion.Exchange2010);
                Exchageser.Credentials = new WebCredentials("administrator", "test", "testtestdomian.in");
                //Exchageser.AutodiscoverUrl("cgvak@minasu.amsoftonline.net");
                Exchageser.Url = new Uri("https://test-exhsvr/ews/exchange.asmx");
               
                //#endregion
                //Folder rootfolder = Folder.Bind(Exchageser, "Directory");
                FolderView view = new FolderView(100);
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
                view.PropertySet.Add(FolderSchema.DisplayName);
                view.Traversal = FolderTraversal.Deep;
                FindFoldersResults findFolderResults = Exchageser.FindFolders(WellKnownFolderName.Contacts, view);                                
                //find specific folder
                foreach (Folder f in findFolderResults)
                {
                    if (f.DisplayName == "GAL Contacts")
                    {
                        FolderId fID = f.Id;

                        Contact objCreatecontact = new Contact(Exchageser);
                        objCreatecontact.GivenName = firstname;
                        objCreatecontact.Surname = lastname;
                        objCreatecontact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress("Ra@testdomian.in");
                        
                        objCreatecontact.Save(fID);
                    }
                }
                
            }
            catch(Exception ex)
            {
                return ex.ToString();
            }

But the above code helps me to add contact to the specific user. Kindly, let me know is there any possibilities to show the contacts in all contacts folder in left navigation.

Thanks..

July 14th, 2015 3:49am

I recommend that you post this in the Development Forum:  http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads

Free Windows Admin Tool Kit Click here and download it now
July 14th, 2015 1:50pm

All Contacts are the Mail-Enabled Active Directory Contact objects from the Global Address List. To Create these you need to use the Exchange Management Shell's New-MailContact cmdlet to create a new mail-enabled contact see https://technet.microsoft.com/en-us/library/bb124519(v=exchg.150).aspx . (You can't not create directory contacts using Exchange Web Services).

Cheers
Glen

July 14th, 2015 10:00pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics