Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue creating upload session on a folder #325

Closed
MilitsaB opened this issue Oct 2, 2024 · 2 comments
Closed

Issue creating upload session on a folder #325

MilitsaB opened this issue Oct 2, 2024 · 2 comments
Assignees
Labels
status no recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close

Comments

@MilitsaB
Copy link

MilitsaB commented Oct 2, 2024

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 (microsoftgraph/msgraph-sdk-dotnet#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?

@MilitsaB MilitsaB added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Oct 2, 2024
@rkodev rkodev self-assigned this Oct 4, 2024
@rkodev
Copy link
Contributor

rkodev commented Oct 7, 2024

Hi @MilitsaB, thanks for trying out the SDK. Are you able to test this example i.e concatenate the folderID + itemPath + ":"

uploadSession, _ := graphClient.Drives().
    ByDriveId(*myDrive.GetId()).
    Items().
    ByDriveItemId(folderID + "/"+"file.txt"+":").
    CreateUploadSession().
    Post(context.Background(), uploadSessionRequestBody, nil)

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 8, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status no recent activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Projects
None yet
Development

No branches or pull requests

3 participants