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

LargeFileUploadTask unable to upload taskFileAttachment #481

Open
3 tasks done
1357310795 opened this issue Aug 19, 2022 · 2 comments
Open
3 tasks done

LargeFileUploadTask unable to upload taskFileAttachment #481

1357310795 opened this issue Aug 19, 2022 · 2 comments

Comments

@1357310795
Copy link

Please provide the following (and please check them off the list with [x]) before submitting this issue:

  • Expected behavior. Please provide links to the specific Microsoft Graph documentation you used to determine the expected behavior.
  • Actual behavior. Provide error codes, stack information, and a Fiddler capture of the request and response (please remove personally identifiable information before posting).
  • Steps to reproduce the behavior. Include your code, IDE versions, client library versions, and any other information that might be helpful to understand your scenario.

Expected behavior

Use LargeFileUploadTask to upload a file to TodoTask Attachment.

public static AttachmentSession UploadAttachment(string tasklistid, string taskid, AttachmentInfo attachmentInfo, Stream ms)
{
    var attachmentsRequestBuilder = client.Me.Todo.Lists[$"{tasklistid}"].Tasks[$"{taskid}"].Attachments;
    var uploadSession = attachmentsRequestBuilder.CreateUploadSession(attachmentInfo).Request().PostAsync().Result;
    var task = new LargeFileUploadTask<AttachmentSession>(uploadSession, ms, 12 * 320 * 1024, client);
    var res = task.UploadAsync().Result;
    return res.ItemResponse;
}

As this document illustrates, first we need to create an upload session. Here's an example of returned uploadUrl

https://graph.microsoft.com/beta/users/6f9a2a92-8527-4d64-837e-b5312852f36d/todo/lists/AAMDiFkfh=/tasks/AAMkADliMm=/attachmentSessions/AAMkADliMm=

Then we should use the upload session to upload (to /content)

PUT https://graph.microsoft.com/beta/users/6f9a2a92-8527-4d64-837e-b5312852f36d/todo/lists/AAMDiFkfh=/tasks/AAMkADliMm=/attachmentSessions/AAMkADliMm=/content

But the LargeFileUploadTask creates a request with WRONG URL

PUT https://graph.microsoft.com/beta/users/6f9a2a92-8527-4d64-837e-b5312852f36d/todo/lists/AAMDiFkfh=/tasks/AAMkADliMm=/attachmentSessions/AAMkADliMm=

Actual behavior

The data is expected to be uploaded to /attachmentSessions/AAMkADliMm=/content but not /attachmentSessions/AAMkADliMm=

Steps to reproduce the behavior

As said above, use LargeFileUploadTask to upload a file to TodoTask Attachment.

Screenshots

image

20220819203938

image

@ghost ghost added the ToTriage label Aug 19, 2022
@1357310795
Copy link
Author

https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-beta

The LargeFileUploadTask is designed for uploading DriveItems which does not need /content

Considering that the Attachments API has just arrived from beta to v1.0, no one may have thought to test the usability of LargeFileUploadTask...........😥

@andrueastman
Copy link
Member

Thanks for raising this @1357310795,

Ideally the response from the API should have the correct URL returned for uploadUrl without need for further modification. This is the case for the other APIs like the ones below.

As this API looks to still be in beta, this may be an API bug/issue. We will raise this with the relevant API team and feedback if this is indeed the intended behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants