vgrem / phpSPO

Microsoft 365 Library for PHP.
MIT License
360 stars 117 forks source link

Recently renamed Folders do not update all properties with the new name #310

Open A-Matt opened 1 year ago

A-Matt commented 1 year ago

Found a bug which might be to do with the fact that not all properties are updated which correspond to the name when you rename an Folder.

In our example, we're checking for the Start of a Folder has an ID and will update the name which is displayed at the end if it's not up to date. The Rename is correctly done however the name property & the getServerRelativeUrl provide back the old name of the folder.

  // Check if the folder is using an old name
  if ($folder->getName() !== $id . ' - ' . $name) {
    $folder = $folder->rename($id . ' - ' . $name)->executeQuery();
  }

  $found = $folder->getServerRelativeUrl();

However running $folder->getName() & $folder->getServerRelativeUrl() after the rename provides the OLD values as these appear to not update.