From 5146bbb7467e4007d76ae5a12be8750c4a666915 Mon Sep 17 00:00:00 2001 From: vgrem Date: Sat, 15 Jul 2023 19:08:48 +0300 Subject: [PATCH] SharePoint API: service root url fix for web resource --- src/SharePoint/Web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SharePoint/Web.php b/src/SharePoint/Web.php index cf4aee10..46035421 100644 --- a/src/SharePoint/Web.php +++ b/src/SharePoint/Web.php @@ -2140,8 +2140,8 @@ public function getResourceUrl() if (!is_null($this->webUrl)) { $urlInfo = parse_url($this->getContext()->getBaseUrl()); $rootSiteUrl = $urlInfo['scheme'] . '://' . $urlInfo['host']; - return "{$rootSiteUrl}{$this->webUrl}/_api/web"; - #return str_replace("/_api", "{$this->webUrl}/_api", $url); + $webPath = str_replace($rootSiteUrl, "", $this->getContext()->getBaseUrl()); + return str_replace("{$webPath}/_api", "{$this->webUrl}/_api", $url); } return $url; }