Getting an error when using the following code. Using latest 2.0 dll… What am I missing?
Dim mailboxUri As String = "http://webmail.hartcorp.com/exchange/"
Dim client As ExchangeClient = New ExchangeClient(mailboxUri & hfEmailID.value & "", hfLoginID.value, Server.UrlDecode(hfPwd.value), "domain")
Dim contacts As MapiContact() = client.ListContacts(client.MailboxInfo.ContactsUri)
dgContacts.DataSource = contacts
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 223:Private Sub dgContacts_NeedDataSource(ByVal [source] As Object, ByVal e As Telerik.WebControls.GridNeedDataSourceEventArgs)
Line 224: Dim client As ExchangeClient = New ExchangeClient(mailboxUri & hfEmailID.value & “”, hfLoginID.value, Server.UrlDecode(hfPwd.value), “domain”)
Line 225: Dim contacts As MapiContact() = client.ListContacts(client.MailboxInfo.ContactsUri)
Line 226: 'dgContacts.DataSource = contacts
Line 227: For Each contact As MapiContact In contacts
Source File: D:\hart11dev\export\mail.aspx Line: 225
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Aspose.Network.Outlook.MapiContact…ctor([] ) +327
Aspose.Network.Exchange.ExchangeClient.(Stream ) +544
Aspose.Network.Exchange.ExchangeClient.ListContacts(String folderUri) +434