Update user avatar via PublicApi

Developer Space

Developer Space
Want to extend the Telligent Evolution platform? Collaborate with other developers and product experts here.

Update user avatar via PublicApi

This question has suggested answer(s)


I am adding users to the system via calls to PublicApi.Users.Create, however I cannot see where I can update the user's avatar. I can see an equivalent call is available via the REST APi, how do I do it within the PublicAPi?


All Replies
  •  - I can not find this in the PublicApi either, however I did find two alternatives:

    1.  The OOTB modal utilizes the following to update a user's uploaded avatar:

    using (Stream inputStream = this.UploadedFile.InputStream)
            user.AvatarUrl = Telligent.Evolution.Avatars.UpdateAvatar(user.UserID, inputStream);

    2.  Another possibility would be to use the same IUserService (in the rest namespace) that the REST endpoints use

     var avatarService = Services.Get<Telligent.Evolution.Rest.Resources.Users.UserService>();
     avatarService.UpdateUserAvatar(// params);

    However I am not sure about the ramifications of using this outside of a REST call, and looking closer, this call uses the same underlying code as in option #1.  

    Have you thought about just calling the REST endpoint to update the avatar from within your C# class?  It may be more of a hassle, but would be supported.