-
Notifications
You must be signed in to change notification settings - Fork 253
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
[Client bug]: SDK is missing option to provide $format QueryOption #1621
[Client bug]: SDK is missing option to provide $format QueryOption #1621
Comments
@andrueastman Any updates on this issue? This is a roadblock for the document conversion application we have. |
@sopelt I tried the following approach but the converted/downloaded PDF File did not seem to have a right format (I renamed the file's extension to docx and MS Word was able to open it). Acrobat reader failed to open the file after saving the content's stream: var requestBuilder = graphClient
.DirectoryObjects
.ToGetRequestInformation(config => config.QueryParameters.Filter = "format=pdf");
var pdfStream = await graphClient.Drives[drive.Id].Items[item.Id].Content.GetAsync(c => c.Options = requestBuilder.RequestOptions.ToList(), cancellationToken); Even using the filter like /cc @andrueastman |
This is a metadata issue causing the missing template. At the moment this can be worked around as below. var requestInformation = graphClient.Drives["driveId"].Items["fileId"].Content.ToGetRequestInformation();
requestInformation.UrlTemplate += "{?format}"; // Add the format query parameter to the template and query parameter.
requestInformation.QueryParameters.Add("format", "pdf");
var stream = await graphClient.RequestAdapter.SendPrimitiveAsync<Stream>(requestInformation); |
@andrueastman Thanks. Any ETA on when a permanent fix will be rolled out? |
This is pretty substantial functionality to leave out of this new version. Any idea as to when this will be implemented correctly? |
@andrueastman EDIT: This didn't seem to be an issue with .NET 7. This seemed to be an issue with a type of .xlsx file. I'm using excel templates in D365 and one template is returning this error. I've tried recreating a different .xlsx template with bare bones features and returned the same error. Can't find any relationship between the file and the error.
Do you have any suggestions? |
Any updates on @erikmf12's last update? I am seeing the same error:
It seems he is using .NET 7. My code is .NET 6 I have narrowed it down to Excel files that are "large" So far I have narrowed the range to work at 6.21MB and lower and confirmed to fail at 12.89 MB or larger. Where the cutoff is between the two sizes is something we are working on. |
@mkoehlerstb My issue was due to the PDF conversion is limited to 250 pages. This means that if the PDF generated is over 250 pages it returns this error. I didn't find this initially since I was working with a template and the data being provided by the template was out of my control. |
@erikmf12 Thank you! You probably just pulled days of work off my plate. |
Any updates on this issue? the following code works for me if the document is already in PDF format - so no conversion is happening.
|
@andrueastman any updates on this since? I am using:
However, conversion is only working on one very small docx file (84.6KB), does not seem to work for pdf(628KB) to pdf, nor xlsx(438KB) to pdf. |
Describe the bug
The Graph API provides a way to retrieve the binary content of a sharepoint drive item while converting its type (e.g. from docx to pdf, or other options when using beta instead of 1.0) as documented here.
The current Microsoft Graph rc does not seem to provide any way of providing a format. I suspect the generated
ContentRequestBuilderGetRequestConfiguration
should haveQueryParameters.Format
to set that.To Reproduce
await GraphServiceClient.Drives[drive.Id].Items[item.Id].Content.GetAsync()
Expected behavior
await GraphServiceClient.Drives[drive.Id].Items[item.Id].Content.GetAsync(c => c.QueryParameters.Format = "PDF")
Client version
Microsoft.Graph/5.0.0-rc.2
Desktop (please complete the following information):
Win 11
Additional context
In the 4.x SDK such parameters seem to have been available to manually add as
Microsoft.Graph.QueryOption
but that seems to have gone away in 5.x (core 3.x)The text was updated successfully, but these errors were encountered: