Adding addresses to Organization through code


Hi There,

I am working on integration webservice that will allow user to upload addresses for organisations.

I can't see or find any method or functionality to add address to an organisation.

The only way I found is creating a dummy Contact with out organisation and add address to it with organisation id.

Can any one help me with this please??



Dec 01, 2015 17:12

FYI: I am working on EpiServer Commerce v8.8

Dec 01, 2015 17:18

Contacts and organizations are part of Business Foundation in Commerce. Specifically, you should use the BusinessManager API. The trick is to associate the address with the organization key. See the following example:

var billingAddress = CustomerAddress.CreateInstance(); 
billingAddress.AddressType = CustomerAddressTypeEnum.Billing;
billingAddress.Line1 = "Some street";
billingAddress.City = "Some city";
billingAddress.OrganizationId = organization.PrimaryKeyId; 
Dec 01, 2015 23:33

Thanks Johan. That works.

Dec 02, 2015 10:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.