[Bug ?] Can not instantiate OCP\Share\IProviderFactory

Hello there,

I can not instantiate a class implementing OCP\Share\IProviderInterface by using

use OCP\Share\IProviderFactory;

class Foobar {

	/** @var IProviderFactory */
	private $providerFactory;

	public function __construct( IProviderFactory $providerFactory) {
		$this->providerFactory = $providerFactory;

	public function getSharetypeForNodes(string $dir, string $userId): array {
		$shareProviders = $this->providerFactory->getAllProviders();
		// ...
		return //...

It do work this ways for OCP\Share\IManager and I was expecting somethig similar for IProviderFactory but it doesn’t.

So I use OC\Share20\ProviderFactory directly as I guess it should have instanciate it automagically and it works. But it is dirty to call the private API, isn’t it ?

What am I doing wrong / not getting ? Should I be able to instanciate OCP\Share\IProviderFactory ?


I am trying to know if some nodes (file || folder) are shares, and how they are shared, in order to display the correct icon, the same way the files app does