1
votes

How How to create a file in a Sharepoint site ?

Should I use the Thybag/SharePointAPI library or another one please ?


My code :

use Thybag\SharePointAPI;
/**
* @Route("/indexExport/", name="index_new_export")
* @return Response
* @throws Exception
*/

public function indexExport(KernelInterface $kernel ){
$sp = new SharePointAPI('login', 'password', 'https://webSite/sites/devistest/_vti_bin/Lists.asmx?WSDL','SPONLINE');
$path = $this->getParameter('kernel.root_dir').'\Controller\Export\devis_vierge.xlsx';
$sp->addAttachment('listeName', 1', $path)'''
$sp = new SharePointAPI('login', 'password', 'https://webSite/sites/devistest/_vti_bin/Lists.asmx?WSDL','SPONLINE');
$path = $this->getParameter('kernel.root_dir').'\Controller\Export\devis_vierge.xlsx';
$sp->addAttachment('listeName', 1', $path);
.....
}

I have this error :

Error (soap:Server) Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.,more=Detailed: L'élément n'existe pas. Il a peut-être été supprimé par un autre utilisateur.

I don't understand

Thanks a lot