Although working with the Microsoft Office Accounting SDK is generally quite straightforward, we have run into some instances where it can be cryptic to do some things that would otherwise seem simple.
One such case is when attempting to set the address information on an "ICustomerAccount ".
In order to get to the underlying address properties see the following code example. Note that the initialization of the "ISmallBusinessInstance" as well as the source of the account data in the DataRow (pRow) object has been ommitted for brevity .
Setting ICustomerAccount Address Details Code Sample:
ICustomerAccount pAccount = smallBusinessInstance.CreateCustomerAccount();
pAccount.Name = pRow["Name"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).Address1=pRow["Address1_Line1"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).Address2=pRow["Address1_Line2"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).City=pRow["Address1_City"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).State=pRow["Address1_StateOrProvince"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).ZipCode=pRow["Address1_PostalCode"].ToString();
pAccount.CustomerVendorAddresses.GetByType(CustomerVendorAddressType.Business).County=pRow["Address1_County"].ToString();
pAccount.CustomerVendorPhones.GetByType(CustomerVendorPhoneType.Business).PhoneNumber=pRow["Telephone1"].ToString();
pAccount.CustomerVendorFaxes.GetByType(CustomerVendorFaxType.Business).FaxNumber=pRow["Fax"].ToString();
pAccount.CustomerVendorEmails.GetByType(CustomerVendorEmailType.Email1).EmailAddress=pRow["EmailAddress1"].ToString();