Click here to Skip to main content
16,016,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Any one please tell me, how to use this code Late Binding methods,
Or add a new contact to outlook by using latebinding methods,
I try all the way there is no used

C#
/Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
            //Microsoft.Office.Interop.Outlook.MAPIFolder Folder_Contacts = (Microsoft.Office.Interop.Outlook.MAPIFolder)

            //outlookApp.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderContacts);
            //Outlook.ContactItem newContact = (Outlook.ContactItem)Folder_Contacts.Items.Add(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem);
            try
            {
                newContact.CompanyName = CompanyName;
                newContact.FirstName = FirstName;
                newContact.LastName = LastName;
                newContact.MiddleName = MiddleName;
                newContact.BusinessAddressStreet = BusinessAddressStreet;
                newContact.BusinessAddressCity = BusinessAddressCity;
                newContact.BusinessAddressState = BusinessAddressState;
                newContact.BusinessAddressPostalCode = BusinessAddressPostalCode;
                newContact.Email1Address = Email2Address;
                newContact.Email2Address = Email1Address;
                newContact.Save();
                newContact.Display(true);
            }
           catch
           {
               MessageBox.Show("The new contact was not saved.");
           }
Posted
Updated 8-Jul-13 1:08am
v2
Comments
Sushil Mate 8-Jul-13 7:10am    
any error/exception?
vijay79041 8-Jul-13 7:12am    
i need late binding methods for the solution
Sushil Mate 8-Jul-13 7:13am    
Late binding?
vijay79041 8-Jul-13 7:20am    
newContact.GetType().InvokeMember("CompanyName", BindingFlags.InvokeMethod, null, newContact, new object[1] {""});

Invoke the Property and methods , dll at run time

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