Initiate user invite programmatically?

Is it possible to initiate a user invite programmatically ?

Yes, you should be able to do it via the IUserService

_userService.InviteAsync(
    Umbraco.Cms.Core.Constants.Security.SuperUserKey,
    new UserInviteModel
    {
      Email = "[email protected]",
      Message = "Welcome to the system",
      Name = "User",
      UserGroupKeys = new List<Guid>() {
          Umbraco.Cms.Core.Constants.Security.EditorGroupKey
      }.ToHashSet(),
      UserName = "username",
    }
);

(I haven’t tested this, but i think it works)

1 Like

It works perfectly, thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.