Files directory not created when calling IUserManager::createUser()


I am working on my first Nextcloud app and have a problem with creating new users programmatically. When calling IUserManager::createUser() everything seems to work alright except the subfolder data/{uid}/files is not created. data/{uid} and data/{uid}/cache are created.

Am I doing something fundamentally wrong?

Thanks in advance for some hints.


Ok, it turns out that folders are created on first login and not when the user is created. Since I am also programmatically logging in the newly created user right away, the issue seems to be located in this area. I will do some research.

Calling IRootFolder::getUserFolder() after creating the user fixes the issue. :grinning:

1 Like

congratulations! :slight_smile: thank you for posting the answer also for future reference!