PurposeThe purpose of this study is to investigate the impact of enterprise social media (ESM) use on two trust dimensions – affect-based trust (ABT) and cognition-based trust (CBT) – as mediators in the relationship between ESM use and knowledge sharing. In the first stage of the proposed model, the authors also consider transparent communication (TC) and personal blogging with colleagues (PBC) during work and non-work hours as moderators that reshape trust levels and subsequently promote knowledge sharing within the organisation.Design/methodology/approachThe authors collected the data in three waves from employees in China, the world’s largest market for social media. Five companies, including three information technology companies and two software companies, were targeted for data collection. Initially, a total of 403 ESM users were recruited, but the final sample in the final round was reduced to N = 292. The authors used Mplus (v8.5) to calculate direct path coefficients and indirect moderated-mediation effects.FindingsThe use of ESM promotes ABT and CBT, thereby improving knowledge sharing. ABT and CBT both fully mediate the effect of ESM use on knowledge sharing. However, the research reveals paradoxical findings regarding moderation. For example, on the one hand, TC negatively moderates the association between ESM use and ABT, thereby reducing knowledge sharing in the workplace. On the other hand, TC strengthens the relationship between the use of ESM and CBT, thereby increasing knowledge sharing. These contradictory findings indicate that TC functions as a double-edged sword; thus, the effective use of ESM in the workplace requires managers’ intervention. Finally, the analysis reveals that the moderating role of PBC strengthens the association between ESM use and both ABT and CBT, thereby increasing knowledge sharing.Originality/valueWhile stakeholders have expressed concern regarding the adverse impacts of workplace ESM adoption on employee performance, the authors provide a broad, novel perspective on the potential of ESM use to enhance knowledge sharing via trust (i.e. ABT and CBT). To the best of the authors’ knowledge, this is the first study to offer a comparative view of trust dimensions, such as ABT and CBT, and to discuss how, why and when TC and PBC interactions moderate the relationship of ESM to ABT and CBT and thereby lead to knowledge sharing. These interesting findings guide further research into the role of ESM in the workplace, especially research based on rational choice theory and communication visibility theory, by illuminating the ways in which employees can use ESM to reshape social communication in the workplace and thereby enhance knowledge sharing.