public function find_share_in_sysaccount($path) {
        $systemaccount = \core\oauth2\api::get_system_account($this->issuer);
        $systemaccountuser = $systemaccount->get('username');

        // Find out share ID from user files.
        $ocsparams = [
            'path' => $path,
            'reshares' => true
        ];

        $getsharesresponse = $this->ocsclient->call('get_shares', $ocsparams);
        $xml = simplexml_load_string($getsharesresponse);
        $validelement = array();
        foreach ($fileid = $xml->data->element as $element) {
            if ($element->share_with == $systemaccountuser) {
                $validelement = $element;
                break;
            }
        }
        if (empty($validelement)) {
            throw new request_exception(array('instance' => $this->repositoryname,
                'errormessage' => get_string('filenotaccessed', 'repository_nextcloud')));
        }
        $shareid = (int) $validelement->id;

        // Use share id to find file name in system account's context.
        $ocsparams = [
            'share_id' => $shareid
        ];

        $shareinformation = $this->systemocsclient->call('get_information_of_share', $ocsparams);
        $xml = simplexml_load_string($shareinformation);
        foreach ($fileid = $xml->data->element as $element) {
            if ($element->share_with == $systemaccountuser) {
                $validfile = $element;
                break;
            }
        }
        if (empty($validfile)) {
            throw new request_exception(array('instance' => $this->repositoryname,
                'errormessage' => get_string('filenotaccessed', 'repository_nextcloud')));

        }
        return [
            'shareid' => $shareid,
            'filetarget' => (string) $validfile->file_target
            ];
    }