get(IConfig::class); return $config->getUserValue($user->getUID(), 'settings', 'email', null); } /** * @throws Exception */ public static function getUserByID(string $id) : ?IUser { $userManager = \OC::$server->get(IUserManager::class); $users = $userManager->getByEmail($id); if (empty($users)) { return null; } if (count($users) > 1) { throw new TooManyUserEmail($id); } return $users[0]; } }