I have written the following VB function to create a contact using the Exchange ews managed API. It creates a contact in teh default contacts folder. However I need to know how to modify it to create a contact in a public folder. The documentation
seems to be poor on this topic. Feel free to reply if you have a solution in VB or C#. Many thanks.
Function create_contact() ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate) Dim service As New ExchangeService(requestedServerVersion:=ExchangeVersion.Exchange2007_SP1) 'Add a valid EWS service end point here or user Autodiscover service.Url = New Uri("https://server/ews/exchange.asmx") 'Add a valid user credentials service.Credentials = New WebCredentials("username", "password", "domain") 'To address the SSL challenge ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate) Try Dim contact As Contact = New Contact(service) contact.GivenName = "Brian" contact.MiddleName = "David" contact.Surname = "Johnson" contact.FileAsMapping = FileAsMapping.SurnameCommaGivenName contact.Save() MsgBox("Contact created!!!") Catch ex As Exception MsgBox(ex.Message) End Try End Function