Closed wanchankein closed 1 year ago
struggeling with this aswell
The example demonsrates how to upload file and set its properties:
$localPath = "../../data/SharePoint User Guide.docx";
$libraryTitle = "Documents";
$lib = $ctx->getWeb()->getLists()->getByTitle($libraryTitle);
$uploadFile = $lib->getRootFolder()->uploadFile(basename($localPath),file_get_contents($localPath))->executeQuery();
$listItem = $uploadFile->getListItemAllFields();
$listItem->setProperty("Title", "Uploaded")->update()->executeQuery(); // update file metadata
where
File.getListItemAllFields
method returns associated list item
Hello, I need to upload a file to a sharepoint document library and set text properties like emailFrom, EmailTo, Language... I've read all the codes but i dont' know how to upload the file and set this properties.
The document library is named "ColaEnvios" i want to upload pdf files and set this properties: emailFrom, EmailTo, Language
This is the code i use. It works and uploads all the pdf files, but i don't know how to add the properties or if this is not the way, please let me know how to do it.