I'm trying to download OneNote (.one) file from the OneDrive using MS Graph API but always get 503 Service Unavailable Error.
I have tried 2 ways of downloading it.
First, using the URL available through the #microsoft.graph.downloadUrl property on the DriveItem.
GET /users/{userId}/drive/items/{item-id}
Then, I tried to download the content using this endpoint
GET /users/{userId}/drive/items/{item-id}/content
But the result is the same. It returns 503 Service Unavailable Error.
Any idea what is the cause?
The file size is around 2.5 GB. Is the big OneNote size make it failed to download?
Thanks
Related
My app is using client_credentials, and is successfully consuming the Graph API on most calls.
However, I have been attempting to get images from a sharepoint folder by path and filename:
https://graph.microsoft.com/v1.0/drive/root:/sites/folder1/folder2/folder3/folder4/photo.jpg
The appropriate headers are being set (authorization and accept).
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + session["access_token"]);
httpClient.DefaultRequestHeaders.Add("accept", "application/json; odata.metadata=minimal");
The request returns a 404 - Not found response.
When I navigate to our sharepoint site, I can see the image fine so I can only assume the file path is correct:
https://ourcompany.sharepoint.com/sites/folder1/folder2/folder3/folder4/photo.jpg
Apologies, but I am new to Graph API and couldn't find anything referencing this in the documentation:
https://learn.microsoft.com/en-us/graph/api/resources/onedrive?view=graph-rest-1.0
Path
/me/drive/root:/path/to/file
Resource
Access a DriveItem by path relative to the user's OneDrive root folder.
Are there special permissions needed for this? I found something suggesting permissions might be required in azure portal but this is to do with azure active directory and I'm not sure if it will affect the graph API, as it was working OK, reading drives and drive items in sharepoint (by drive id and drive item id, not by file path).
EDIT: Went into azure portal, added Graph API permissions to application:
Site: ReadAll
Directory: ReadAll
File: ReadAll
No change so far.
A site contains the drive so you're referencing things in the wrong order. To get a DriveItem from a site's drive, you want this:
/sites/{siteId}/drive/root:/folder1/folder2/folder3/folder4/photo.jpg
If you're looking to download the DriveItem instead of just retrieving the metadata, you'll want this:
/sites/{siteId}/drive/root:/folder1/folder2/folder3/folder4/photo.jpg:/content
For my project need, I need to convert MS format documents in to pdf. I started exploring microsoft graph API. For easiness I started with graph explorer(using my corporate and personal login) on https://developer.microsoft.com/en-us/graph/graph-explorer.
I have added sample document in drive and using https://graph.microsoft.com/v1.0/me/drive/root/children, I got itemId of my file.
Now, I am trying to convert it into pdf using https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf. But I am always getting response as Failure - Status Code 0
Anyone has an idea how to fix this issue?
Here is an attached screen shot of microsoft graph explorer
Note: I found similar problem here but it is not solved
According to your description, I assume you want to convert .docx file to pdf using Microsoft graph API.
Based on my test, we can use https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf.
It will return a failure response when run it in graph explore. However, when we use the develop control panel, we can get this request and response.
Location properties are in the response headers. It is the address of the converted file.
We can use this URI to review or download the document that converted.
The request URL:
https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf
The response may like this:
I'm trying to update my profile picture using Microsoft Graph Explorer (v1.0) but I'm unable to do it, I'm always getting the following error :
An internal server error occurred. The operation failed., The file you chose isn't an image. Please choose a different file.
The problem is that the file I'm trying to update my picture with is an image inserted in the request body (a base64 representation of it, I used this site in order to get it: https://www.base64-image.de/).
I'm also using the header Content-Type with the value image/jpeg and I think that, as I'm logged, I don't need the authorization header.
The URL I'm using is: https://graph.microsoft.com/v1.0/me/photo/$value
This endpoint takes the raw image as input, not a base64 encoded version. From the documentation:
Request body
In the request body, include the binary data of the photo in the request body.
Since it isn't possible to stream a file like this using Graph Explorer, updating the photo isn't supported by Graph Explorer.
I'm trying to use HTTP Request to upload and store a file via a POST to a REST api. I can't use HTTP Raw because it is an https request.
I can successfully accomplish this with smaller files (<= 500 kb). With larger files (>= 582 kb) it fails with a 500 Error: Connection error. I know it is not an issue with my REST api because I can use POSTMAN and successfully post the same file.
These are images or audio recordings, not text files.
No errors appear in the jmeter logs.
Is there a setting controlling the size somewhere I haven't found? Is there anyway to get this to work successfully?
Trying to follow instructions from google and upload a csv for a new fusion table. The page throws a very helpful error 'Import failed. Please retry.', and the dev console shows the server actually returned an http 405 error 'HTTP method POST is not supported by this URL'
page:
https://fusiontables.google.com/DataSource?dsrcid=implicit
Is there another way to upload csv files?
Your link suggests that you're trying to upload a 228mb file. I think I had some issued with large CSVs too. You could cut it up into smaller files until the error goes away, but IIRC the maximum file size is something like 5mb.
My preferred work-around is importing via Google Sheets. Upload your CSV to Drive, re-save it from Sheets, then import the Sheet into Fusion Tables.