We are using the following api for converting file to pdf in Microsoft Graph API.
https://graph.microsoft.com/v1.0/me/drive/items/[item-id]/content?format=pdf
I tried to convert a .xlsx file that was over 1MB to .pdf by this api.
However, it returned following error:
{
"error": {
"code": "notSupported",
"message": "...",
"innererror": {
"code": "OfficeConversion_NotSupported"
}
}
}
Is this behavior expected?
The reference for this api is below.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_get_content_format
This is unfortunately a known limitation of PDF conversion for XLSX. I'd suggest making sure an idea exists, and is upvoted, on https://onedrive.uservoice.com/forums/913708/.
Related
Microsoft have provided the Graph API for updating the printer attributes, I could send a JSON or a IPP payload, JSON payload works fine, but updating printer attributes (Group 2 as in the https://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf) with a IPP payload returns the following error.
{
"error": {
"code": "500",
"message": "Additional data found after serialized IPP attribute group.
First byte of additional data: Reserved",
"innerError": {
"date": "2020-09-29T09:25:18",
"request-id": "e103342b-96a3-44b0-adb2-f97b29dc3846",
"client-request-id": "e103342b-96a3-44b0-adb2-f97b29dc3846"
}
}
}
what is wrong with the payload, Any idea why?
There is a similar issue reported in Github and issue has been closed, there is no resolution details.
I have tried this i am able to create event but this error i am getting.
body_json={
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "menu.txt",
"contentBytes": "base64bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
API =" https://graph.microsoft.com/v1.0/users/{}/events/{}/attachments".format(userId,meetingID)
body_json = json.dumps(body_json)
response = requests.request("POST", url=API, data=body_json, headers=self.headers)
error : <Response [400]> {"error":{"code":"UnableToDeserializePostBody","message":"were unable to deserialize "}}
The issue here is because the data which you are putting in the contentBytes property is not BASE64. As you are following the documentation they gave that example to make you understand that the data is base64. But actually in the example its not base64. So you can convert it to base64 online as below and test it.
This is the request body I used which has Hello World.
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "menu.txt",
"contentBytes": "SGVsbG8gV29ybGQ="
}
Which gave me successful results in graph explorer. You can use it to test Graph API calls.
We are getting 400 API error on some of the files when we try to download them using below API:
https://graph.microsoft.com/v1.0/users/<user-id>/drive/items/<item-id/content
API doc : https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http
Error:
"error": {
"code": "invalidRequest",
"message": "One of the provided arguments is not acceptable.",
"innerError": {
"code": "badArgument",
...
Same API calls works for most of the files, but we are getting this error recently.
Kindly let me know What's the reason behind it? and how can we fix?
I am trying to download documents attached to a OneNote Page using the Microsoft Graph API.
I find attached documents by looking for <object> elements like this in the document:-
<object data-attachment="test.txt" type="text/plain" data="https://graph.microsoft.com/v1.0/siteCollections/contoso.sharepoint.com,eb44cb06-54aa-4c1b-b749-14a6bc939040,90c50fc9-e9d8-483c-817d-a6006510e8e8/onenote/resources/1-11dbf2c6ff9e32c6a479858c38ac4688!1-c256504c-f305-4df3-9d00-f6d72aef06fc/$value"></object>
According to this page the data attribute is the URL to the file. I make a GET request to that url, replacing $value in the URL with content according to how files are downloaded as binary as described here, authorizing my request with the token.
When I perform this request, I get HTTP Code 400 and the following in the body:-
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'siteCollections'.",
"innerError": {
"date": "2020-08-14T12:32:04",
"request-id": "6b7a9242-8cc0-4df5-afb6-075735045d0d"
}
}
}
What am I doing wrong?
Replacing /siteCollections/ with /sites/ in the URL produced a URL that yielded a successful response.
Weird quirk of OneNote?
When calling the createSession or workbook/worksheets endpoint I'm getting the following error:
{
"error": {
"code": "OpenWorkbookTooLarge",
"message": "Service Unavailable.",
"innerError": {
"request-id": "c997d356-c343-44bb-b49b-fc03d7482f75",
"date": "2018-11-28T22:58:21"
}
}
}
The spreadsheet in OneDrive has only one sheet with 16 columns and about 160,000 rows. Is that too large to work with? That would be very disappointing...
Excel Online have file size limit, based on the docs and the error you get, you have trigger the limitation, maybe not file size but other one.
Workbooks that exceed 10 megabytes (MB) cannot be viewed in Excel
Online from within Microsoft SharePoint Online.
For none-dev user, they can use the PowerBI/Local Excel/PivotTable as workaround.
For devolper, there are no workaround now.
Jeez, it's even worse: 5MB
That's sad, really.