microsoftgraph / msgraph-sdk-go-core

Microsoft Graph SDK for Go - Core Library
https://learn.microsoft.com/graph/sdks/sdks-overview
MIT License
19 stars 9 forks source link

Issue creating upload session on a folder #325

Open MilitsaB opened 2 days ago

MilitsaB commented 2 days ago

I am trying to create an upload session to upload a file in a folder in Sharepoint. I am receiving the following error: Cannot create an upload session on a folder. I understand that an upload session cannot be created on a folder, however I am not sure how I can create one.

This is what I am currently doing:

uploadSession, err := graphClient.
        Drives().ByDriveId(driveID).
        Items().ByDriveItemId(folderID).
        CreateUploadSession().
        Post(ctx, uploadSessionRequestBody, nil)

I noticed that the msgraph-sdk-net has a method ItemWithPath which is not available in the Go version (https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1353)

var uploadSession = await graphClient.Sites["site-id"].Drive.Items["folderId"].ItemWithPath("file.txt")
                            .CreateUploadSession(uploadProps)
                            .Request()
                            .PostAsync();

Any ideas on how I can do this using msgraph-sdk-go?