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

Content type application/octet-stream does not have a factory registered to be parsed Error when getting PDF from File #2500

Closed
Ofer-Gal opened this issue May 18, 2024 · 2 comments

Comments

@Ofer-Gal
Copy link

Describe the bug

                var stream = await _graphClient.Drives[drive.Id].Items[driveItem.Id].Content.GetAsync((requestConfiguration) =>
                {
                    requestConfiguration.QueryParameters.Format = "{'pdf'}";
                });

Throws "Content type application/octet-stream does not have a factory registered to be parsed"

Expected behavior

Using "Microsoft.Graph" Version="5.53.0" and the sample from here
I expect to get a a 302 Found response with Location.
But instead I get this error

How to reproduce

Get a GraphServiceClient
Get a site ID
Get a Drive from the SharePoint Library
Get the file DriveItem to convert to PDF
Use the code sample.

SDK Version

5.53.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```

[2024-05-18T15:41:07.620Z] Host lock lease acquired by instance ID '00000000000000000000000006CA2F1E'.
[2024-05-18T15:41:12.458Z] Executing 'Functions.PDFaFile' (Reason='This function was programmatically called via the host APIs.', Id=3deb339d-1118-4c8a-9d04-d9290819ed42)
[2024-05-18T15:41:12.787Z] Starting Job: T002.128-2
[2024-05-18T15:41:31.879Z] Content type application/octet-stream does not have a factory registered to be parsed

</details>


### Configuration

Windows Visual Studio 2022

### Other information

_No response_
@Ofer-Gal Ofer-Gal added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels May 18, 2024
@andrueastman
Copy link
Member

Thanks for raising this @Ofer-Gal

I don't believe the Format string should be having curly braces.

Any chance you can confirm if the error is replicated by making the request as below?

   var stream = await _graphClient.Drives[drive.Id].Items[driveItem.Id].Content.GetAsync((requestConfiguration) =>
  {
      requestConfiguration.QueryParameters.Format = "pdf";
  });

@andrueastman andrueastman added Needs: Author Feedback and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels May 20, 2024
@Ofer-Gal
Copy link
Author

Yes you are right. the curly braces caused the error. 😒
It works fine now.

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