-
Notifications
You must be signed in to change notification settings - Fork 8
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
Getting contents of a file in drive using DriveItem getContent() #128
Comments
Please show the stack trace of the NullPointerException. |
Also put on debug logging so we can see the metadata returned with the Drive Item (I want to see the json payloads). |
Looking at https://docs.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0 it appears that microsoft in their wisdom (!!!) have chosen to use non-standard metadata fields for the download url ( |
You can try your code again with 0.1.53-SNAPSHOT if you like (build latest master branch) as I've added a bit of a bandaid to use |
Note also from README.md: https://github.com/davidmoten/odata-client#streams (add .metadataFull() before calling .get()) |
Hi David, I tried with the 0.1.53-SNAPSHOT but still facing same issue (stack trace at the end). Attaching the Drive Item json for your ref. When I tried calling .metadataFull() before calling get(), I get a different error though. Adding it seems to add an extra /$value at the end of the request url :
Here is the stack trace of the null pointer exception without .metadataFull()
|
Thanks for the details @AmudhaNila. I'm relieved to see the |
I've applied the fixes in PR # 128 which has been merged. Can you build 0.1.53-SNAPSHOT again from master and try that call again please? |
I've released 0.1.53 with these fixes, can you try that version please? |
I've also raised https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/3582 to fix the graph documentation. |
Hi David, I tested with 0.1.53 and the fix works as expected. I am now able to get the stream provider of contents of a drive item using Thanks a lot. |
No worries. Thanks for the report. I hadn't bumped into stream properties yet in my own use cases so was an untested path. |
By the way, the need to specify metadataFull() before getting a stream is an annoying gotcha that will probably bite lots more people. I'm thinking I might default to full metadata for any media entity or entity with a stream property. I'll raise a PR for this soon, comments welcome. |
…st for an entity that is a Media Entity or has a stream property #128
Hi David,
I am trying to get the raw contents of a file in drive using the DriveItem getContent() method. But even though the file has contents, it is null in the DriveItem class. getContent() hits a null pointer exception even though the graph API on the itemid /content works.
Can you please confirm the way to use this method? Am I missing something?
Thanks
The text was updated successfully, but these errors were encountered: