GithubHelp home page GithubHelp logo

Comments (13)

AmudhaNila avatar AmudhaNila commented on June 15, 2024 1

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
graphService .drives(driveId) .items(itemId) .metadataFull() .get() .getContent();

Thanks a lot.

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024 1

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.

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

Please show the stack trace of the NullPointerException.

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

Also put on debug logging so we can see the metadata returned with the Drive Item (I want to see the json payloads).

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

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 (@microsoft.graph.downloadUrl). Seeing the DriveItem json returned (or print out item.getUnmappedFields().entrySet()) would be great, thanks.

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

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 @microsoft.graph.downloadUrl if it exists (and the expected OData metadata field of [email protected] is not present).

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

Note also from README.md: https://github.com/davidmoten/odata-client#streams (add .metadataFull() before calling .get())

from odata-client.

AmudhaNila avatar AmudhaNila commented on June 15, 2024

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.
driveItem.txt

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 :

getStream returned HTTP 400
url=https://graph.microsoft.com/v1.0/drives('b%219BWQkwb6BU-FGYNtnMEvuM_f_Djq5I9MvNVLQbVWhmdpm4AZrhScTbapjoB5OoNJ')/items('01OKI7IIFLATICNLEZLVFKWT5F7TT7C2E4')/content/%24value
headers=[]
response:
{"error":{"code":"BadRequest","message":"The request URI is not valid. The segment 'content' must be the last segment in the URI because it is one of the following: $ref, $batch, $count, $value, $metadata, a named media resource, an action, a noncomposable function, an action import, a noncomposable function import, an operation with void return type, or an operation import with void return type.","innerError":{"date":"2021-04-28T12:16:40","request-id":"77c43951-83e2-4f99-a626-e072c1b541eb","client-request-id":"77c43951-83e2-4f99-a626-e072c1b541eb"}}}

Here is the stack trace of the null pointer exception without .metadataFull()

java.lang.NullPointerException: null
at com.github.davidmoten.odata.client.Path.addSegmentDelimiter(Path.java:52) ~[odata-client-runtime-0.1.49.jar:na]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP GET "/api/o365/v1/drives/b!9BWQkwb6BU-FGYNtnMEvuM_f_Djq5I9MvNVLQbVWhmdpm4AZrhScTbapjoB5OoNJ/items/01OKI7IIFLATICNLEZLVFKWT5F7TT7C2E4/content" [ExceptionHandlingWebHandler]
Stack trace:
at com.github.davidmoten.odata.client.Path.addSegmentDelimiter(Path.java:52) ~[odata-client-runtime-0.1.49.jar:na]
at com.github.davidmoten.odata.client.Path.addSegment(Path.java:42) ~[odata-client-runtime-0.1.49.jar:na]
at com.github.davidmoten.odata.client.internal.RequestHelper.createStreamForEdmStream(RequestHelper.java:463) ~[odata-client-runtime-0.1.49.jar:na]
at odata.msgraph.client.entity.DriveItem.getContent(DriveItem.java:499) ~[odata-client-msgraph-0.1.49.jar:na]

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

Thanks for the details @AmudhaNila. I'm relieved to see the [email protected] field and $value should not be appended to a stream property (only media entities) so I'll fix that. I'll also fix the NPE. I assume the [email protected] only turns up when .metadataFull() is added?

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

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?

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

I've released 0.1.53 with these fixes, can you try that version please?

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

I've also raised microsoftgraph/microsoft-graph-docs-contrib#3582 to fix the graph documentation.

from odata-client.

davidmoten avatar davidmoten commented on June 15, 2024

No worries. Thanks for the report. I hadn't bumped into stream properties yet in my own use cases so was an untested path.

from odata-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.