Skip to content

SharingLink->getWebUrl() incorrectly mapped #1583

Closed
@bsprengelmeijer

Description

@bsprengelmeijer

Describe the bug

When I request a sharing link, I can't access the webUrl because it is nested inside a link property, which is missing in getWebUrl()

This is my response
image

And this is the getWebUrl()

public function getWebUrl()
    {
        if (array_key_exists("webUrl", $this->_propDict)) {
            return $this->_propDict["webUrl"];
        } else {
            return null;
        }
    }

Expected behavior

->getWebUrl() returns the _propDict[link][weburl]

How to reproduce

$graphRequest = $this->graph->createRequest(Request::METHOD_POST, "/drives/{drive_id}/items/{microsoft_id}/createLink");

$graphRequest
       ->attachBody([
            'type'  => 'view',
            'scope' => 'anonymous',
       ])
       ->setReturnType(SharingLink::class);

/** @var SharingLink $sharingLink */
$sharingLink = $graphRequest->execute();

SDK Version

1.110.0

Latest version known to work for scenario above?

No response

Known Workarounds

Override sharingLink

class SharingLink extends \Microsoft\Graph\Model\SharingLink
{
    public function getLink(): ?string
    {
        if (array_key_exists('link', $this->_propDict) && array_key_exists('webUrl', $this->_propDict['link'])) {
            return $this->_propDict['link']['webUrl'];
        }

        return null;
    }
}

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

Labels

type:questionAn issue that's a question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions