404 on large file upload for todo task attachment
ThomasWiestBF opened this issue · 2 comments
Hello,
I am using the SDK version 2.4.0 and have encountered a strange behaviour/error. I am trying to upload a large file (~5MB) to a ToDo task. The initial POST request to create an upload session is successful, but the API gives me a 404 error with "Unknown Error" on the PUT request for the first file chunk.
Is there a bug or am i missing anything?
Thank you very much!
Code:
$attachmentInfo = new AttachmentInfo();
$attachmentInfo->setAttachmentType(new AttachmentType('file'));
$attachmentInfo->setName($attachmentName);
$attachmentInfo->setSize($fileSize);
$uploadSessionRequestBody = new CreateUploadSessionPostRequestBody();
$uploadSessionRequestBody->setAttachmentInfo($attachmentInfo);
$uploadSession = $this->client->me()
->todo()->lists()->byTodoTaskListId($taskListId)
->tasks()->byTodoTaskId($graphItemId)->attachments()
->createUploadSession()->post($uploadSessionRequestBody)->wait();
$largeFileUpload = new LargeFileUploadTask($uploadSession, $this->client->getRequestAdapter(), $fileStream);
try {
$uploadSessionResult = $largeFileUpload->upload()->wait();
} catch (NetworkExceptionInterface $ex) {
// resume upload in case of network errors
$retries = 0;
$maxRetries = 3;
while ($retries < $maxRetries) {
try {
$uploadSession = $largeFileUpload->resume()->wait();
if ($uploadSession) {
break;
}
} catch (NetworkExceptionInterface $ex) {
$retries++;
}
}
throw $ex;
}
Thanks for raising this @ThomasWiestBF
If you checkout the docuementation for the uploading of files to the TODO apis, the uploadUrl from the upload session needs some modification which is inconsistent with other APIs.
Any chance you can confirm the upload works for you if you modify the uploadUrl
varialble in the uploadSession
by appending /content
to it before creating the LargeFileUploadTask
?
Thanks for raising this @ThomasWiestBF
If you checkout the docuementation for the uploading of files to the TODO apis, the uploadUrl from the upload session needs some modification which is inconsistent with other APIs.
Any chance you can confirm the upload works for you if you modify the
uploadUrl
varialble in theuploadSession
by appending/content
to it before creating theLargeFileUploadTask
?
Thank you very much!
I can confirm that appending /content
to the uploadUrl
before creating the LargeFileUploadTask
does work.