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

        $body = [
            'parentReference' => [
                'id' => $destinationItem->id,
            ],
        ];

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

        $status = $response->getStatus();

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

        $headers = $response->getHeaders();

        return $headers['Location'][0];
    }
public function copy(self $destinationItem, array $options = [])
    {
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator/copy";

        $body = [
            'parentReference' => [
                'id' => $destinationItem->id,
            ],
        ];

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

        $status = $response->getStatus();

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

        $headers = $response->getHeaders();

        return $headers['Location'][0];
    }
public function copy ( self $ destinationItem , array $ options = [ ] ) { $ driveLocator = "/drives/{$this->parentReference->driveId}" ; $ itemLocator = "/items/{$this->id}" ; $ endpoint = "$driveLocator$itemLocator/copy" ; $ body = [ 'parentReference' => [ 'id' => $ destinationItem -> id , ] , ] ; $ response = $ this -> graph -> createRequest ( 'POST' , $ endpoint ) -> attachBody ( $ body + $ options ) -> execute ( ) ; $ status = $ response -> getStatus ( ) ; if ( $ status != 202 ) { throw new \ Exception ( "Unexpected status code produced by 'POST $endpoint': $status" ) ; } $ headers = $ response -> getHeaders ( ) ; return $ headers [ 'Location' ] [ 0 ] ; }
Copies this drive item.

@param DriveItemProxy $destinationItem
The destination item.
@param array $options
The options.

@return string
The progress URI.

@todo Support asynchronous Graph operation.
Copies this drive item .