I found on this website several questions speaking of IATA, ICAO and airports codes. The fact that two identification codes for the same airport exist means there are cases where you use one, and other cases where you use the other. I wonder what is the rule to know which code (IATA or ICAO) should be used.
It helps to know the objective of both ICAO and IATA to understand when which code is used.
ICAO (International Civil Aviation Organization) is a UN-body which focusses on international harmonization of civil aviation regulations.
ICAO codes are used for "official" purposes such as Air Traffic Control; E.g. flight plans use ICAO codes for airports and airline flight identification.
IATA (International Air Transport Association) is a trade association that focusses on making air traffic businesses safe, secure, reliable and efficient.
IATA codes are mainly used for ticketing. E.g. travel itineraries use IATA codes for airports and IATA flight numbers.