PurposeIn the digital age, enterprise social media (ESM) has been broadly used to break the barrier of space and time for knowledge sharing involving two activities—knowledge donating and knowledge collecting. Yet, hardly any study has thus far explored how and when knowledge donating and knowledge collecting through ESM impact employees’ innovative work behavior (IWB). Therefore, drawing on the social exchange theory, this study aims to introduce relational social capital as a mediator and performance climate as a moderator to examine differential impact mechanisms of knowledge donating and knowledge collecting through ESM on employee IWB.Design/methodology/approachFirst, we collected 225 survey data from employees who used ESM at work. Then, according to the two-stage procedure of the partial least square structural equation modeling method, we established and analyzed a moderated mediation model based on the context of ESM.FindingsResults demonstrate that knowledge donating through ESM has a positive relationship with IWB, but knowledge collecting through ESM has no such relationship. Through the mediation of relational social capital, both knowledge donating and knowledge collecting through ESM have indirect positive relationships with IWB, but knowledge collecting through ESM has a greater one. Moreover, when employees perceived a relatively high-performance climate, the positive relationships of knowledge donating and knowledge collecting through ESM with IWB via relational social capital would be stronger.Practical implicationsOn the one hand, organizational managers should not only focus on different innovation benefits caused by knowledge donating and knowledge collecting through ESM but also should realize differences in the direct/indirect effect of knowledge donating and knowledge collecting through ESM on IWB. On the other hand, employees need to proactively enhance their innovative ability by considering knowledge donating/collecting channels (e.g. ESM), gaining successful competitiveness. Moreover, both managers and employees should realize that different innovation benefits of knowledge sharing activities through ESM can be further strengthened when establishing a high-performance climate.Originality/valueDifferent from prior literature on knowledge sharing or ESM, this study contributes to analyzing the differential effects of two dimensions (i.e. knowledge donating and knowledge collecting) of knowledge sharing on employees' IWB in the context of ESM.