Skip to content

Allow hostname operations without a valid site #7

Description

@DignitySAMP

Hello there,

I encountered an issue using the https://github.com/gwsn/flysystem-sharepoint-adapter package.

In my use case, document libraries exist directly under the root site (e.g., https://tenant.sharepoint.com/LibraryName/ instead of https://tenant.sharepoint.com/sites/SiteName/).

Querying the root level site through the given example returns a "Cannot parse the body of the sharepoint site request" error when querying it.

I fixed this by writing a custom connector that skips this condition entirely (https://github.com/gwsn/sharepoint-sdk/blob/main/src/Sharepoint/SharepointService.php#L45):

Severely redacted snippet of my code:

foreach ($drives as $drive) {
        if ($drive['name'] === $driveName) {
                $driveId = $drive['id'];
                break;
        }
}

if (isset($driveId)) {
        $driveService = new DriveService($accessToken);
        $driveService->setDriveId($driveId);
        $this->setDrive($driveService);

        $this->setFolder(new FolderService($accessToken, $driveId));
        $this->setFile(new FileService($accessToken, $driveId));
}

I'm not sure if this is the best way to address this issue.

I'd like to suggest a more flexible approach where you can directly query the root site instead of requiring the /sites/xxx prefix.

If this is already possible, an example would be greatly appreciated. I could not get it to work personally.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions