src/Proxy/DriveItemProxy.php
public function rename($name, array $options = [])
    {
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator";

        $body = [
            'name' => (string) $name,
        ];

        $response = $this
            ->graph
            ->createRequest('PATCH', $endpoint)
            ->attachBody($body + $options)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'PATCH $endpoint': $status");
        }

        $driveItem = $response->getResponseAsObject(DriveItem::class);

        return new self($this->graph, $driveItem);
    }
public function rename($name, array $options = [])
    {
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator";

        $body = [
            'name' => (string) $name,
        ];

        $response = $this
            ->graph
            ->createRequest('PATCH', $endpoint)
            ->attachBody($body + $options)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'PATCH $endpoint': $status");
        }

        $driveItem = $response->getResponseAsObject(DriveItem::class);

        return new self($this->graph, $driveItem);
    }
public function rename ( $ name , array $ options = [ ] ) { $ driveLocator = "/drives/{$this->parentReference->driveId}" ; $ itemLocator = "/items/{$this->id}" ; $ endpoint = "$driveLocator$itemLocator" ; $ body = [ 'name' => ( string ) $ name , ] ; $ response = $ this -> graph -> createRequest ( 'PATCH' , $ endpoint ) -> attachBody ( $ body + $ options ) -> execute ( ) ; $ status = $ response -> getStatus ( ) ; if ( $ status != 200 ) { throw new \ Exception ( "Unexpected status code produced by 'PATCH $endpoint': $status" ) ; } $ driveItem = $ response -> getResponseAsObject ( DriveItem :: class ) ; return new self ( $ this -> graph , $ driveItem ) ; }
Renames this file item.

@param string $name
The name.
@param array $options
The options.

@return DriveItemProxy
The drive item renamed.
Renames this file item .