- Visual Studio 2010 (any edition).
- This is a command-line application and will run on any Windows.
A list of existing Visma Severa accounts is required for this code example as an input file. Such list can be created from Visma Severa:
- Click Browse on top menu.
- Select All accounts (or any other saved account report).
- Click on the CSV icon on top of the accounts list to save a CSV file of your account list.
Example CSV account list:
Account number;Account name;VAT number;Address;Postal code;Headquarters city;Account owner 1008;2nd Telecom Oy;;Mannerheimintie 12;00100;Helsinki;Flaming, Tony 1070;A Proctor Group Ltd;;The Haugh;;Blairgowrie;Stanley, Mark 1069;A Proctor Group UK Ltd;;The Haugh;;Blairgowrie;Stanley, Mark 1068;Aardvark Consulting;;;;;Riley, Nathan 1033;ACCESS TEST;;;;;Stanley, Mark 1021;Acme Oy;;Canon Street 123;lt 3454;London;Ashley, Lauren 1009;Acme Technology Inc.;;Street 12;90210;Beverly Hills;Stanley, Mark 1075;Aco Technologies Plc;;Aco Business Park;SG17 5TE;Bedfordshire;Stanley, Mark
Download the source code zip package, which is as attachment in this article.
- Give the application two arguments: your API key, and the name of your account CSV file. The arguments can be found from the properties of the solution, from the Debug tab. Separate the arguments from each other with a space:
Put the account CSV file inside folder ...\Update accounts\bin\x64\Debug
The program will iterate the given CSV file and make sure that the account's head office address will have the country of Finland (FI)
Read 1 line from the file.
Extract the unique account number with regular expression: System.Text.RegularExpressions.Regex.Match(line, "^([0-9]+);")
Get the account information for the given account number.
Get the internal company information from the account information.
Get the head office address information from the company.
Confirm that the address has country information, if does, next line.
Set the address country to be the preloaded Finland country GUID.
Update the address.