Online learning environments are perceived to facilitate interaction and knowledge sharing among individuals. However, participants do not log on frequently or are reluctant to share ideas with others. Therefore, it is crucial for teachers to understand when and how interaction and knowledge sharing happen. The present study develops two new scales to measure an individual's evaluation of the degree to which an online learning environment can facilitate the formation and maintenance of relationships. Then, the hypothesized relationships between the two constructs and knowledge sharing in online learning environments are tested. The results indicate that both the need to form and to maintain relationships are important determinants. Individuals who found that an online learning environment helped him or her to form or maintain relationships reported knowledge sharing behaviour. In addition, the higher was the evaluation of individuals of the degree to which an online learning environment supported relationship maintenance, the higher was their evaluation of the degree to which the online learning environment facilitated relationship formation.