patch()
Patch a file or folder
patch()
Update an file. This can be e.g. used to rename a file.
Parameters
Name
Type
Description
$id
string
ID of the entry that should be updated.
$update_request
array
The content that should be patched. E.g. ['name' => 'new_name'].
Return
Name
Type
Description
$node
CachedNode
The object for the patched file.
Usage
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');
// Update request to rename, and add a description
$updaterequest = [
'name' => 'Another picture.jpg',
'description' => 'Nunc sit amet convallis ante, nec molestie leo. Duis quis egestas arcu. Sed lacinia imperdiet tellus et molestie. Nulla at ornare diam, ac pretium augue. '
];
// Patch the file or folder
$node = WPCP_ONEDRIVE_API::patch('01EXLSWHWMQZNDMLRG7NFIWAVYCFJAXP2R', $updaterequest);
Last updated