phpSPO icon indicating copy to clipboard operation
phpSPO copied to clipboard

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

Open A-Matt opened this issue 2 years ago • 0 comments

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.

A-Matt avatar Nov 28 '22 16:11 A-Matt