Polar and nonpolar ZnO thin films were deposited on MgO (001) substrates under different deposition parameters using oxygen plasma-assisted molecular beam epitaxy (MBE). The orientations of ZnO thin films were investigated by in situ reflection high-energy electron diffraction and ex situ X-ray diffraction (XRD). The film roughness measured by atomic force microscopy evolved as a function of substrate temperature and was correlated with the grain sizes determined by XRD. Synchrotron-based X-ray absorption spectroscopy (XAS) was performed to study the conduction band structures of the ZnO films. The fine structures of the XAS spectra, which were consistent with the results of density functional theory calculation, indicated that the polar and nonpolar ZnO films had different electronic structures. Our work suggests that it is possible to vary ZnO film structures from polar to nonpolar using the MBE growth technique and hence tailoring the electronic structures of the ZnO films. PACS: 81; 81.05.Dz; 81.15.Hi.