Open oliveira-alexdias opened 3 years ago
Hey @oliveira-alexdias. Thanks for bringing this up! This issue is because the SDK currently doesn't support OData cast. We have plans to fix this in early 2022.
As a workaround, you can use BaseRequest to access the GetDownloadUrl method as follows:
var requestUrl = graphClient
.Compliance
.Ediscovery
.Cases["{ediscovery.case-id}"]
.Operations["{ediscovery.caseOperation-id}"]
.AppendSegmentToRequestUrl("microsoft.graph.ediscovery.caseExportOperation/getDownloadUrl");
var request = new BaseRequest(requestUrl, graphClient);
var response = await request.SendAsync<ODataMethodStringResponse>(null, CancellationToken.None);
var @string = response.Value;
Hope this can help.
Hey @maisarissi I believe there is an issue in Download URL functionality. Either getting the Download URL through this workaround you gave me or getting the Download URL through HTTP call it is returning a 500 Internal Server Error.
Could you please check it?
var client = await graph.GetROPCClient(Scopes.Default);
var requestUrl = client .Compliance .Ediscovery .Cases[aedCaseId.ToString()] .Operations[aedExportId] .AppendSegmentToRequestUrl("microsoft.graph.ediscovery.caseExportOperation/getDownloadUrl");
var request = new BaseRequest(requestUrl, client);
var response = await request.SendAsync
- _Message:_
Code: InternalServerError
Message: An unexpected error occurred.
Inner error:
AdditionalData:
date: 2021-12-14T18:35:56
request-id: f79c42c4-d465-4624-9c37-d4bc19cd910c
client-request-id: f79c42c4-d465-4624-9c37-d4bc19cd910c
ClientRequestId: f79c42c4-d465-4624-9c37-d4bc19cd910c
- _e.StackTrace:_
at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__40.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Graph.BaseRequest.<SendAsync>d__34`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Exports.Services.<GetDownloadUriForBrowserDownload>d__27.MoveNext() in .\Functions\Exports\Services\GetDownloadUrl.cs:line 52
- **Using HTTP Call**
![image](https://user-images.githubusercontent.com/78912689/146062968-831e06c3-c084-4cea-9e74-a698d364f701.png)
@mahage-msft can you take a look at this? Since the error is also happening in the Graph Explorer doesn't sound like an SDK error. There is also this question in the Q&A: https://docs.microsoft.com/en-us/answers/questions/666906/getdownloadurl-api-method-no-longer-working.html
Hi @oliveira-alexdias . Are you still getting 500 using the workaround provided above?
Hey @maisarissi! Now it is working as expected. Thank you.
Great to hear @oliveira-alexdias .
I'll keep this issue open to track the OData cast fix so we can have the GetDownloadUrl as part of the Fluent API. Thank you!
This is currently not showing up on the OpenAPI reference metadata due to the conversion library limiting child paths on derived/odata cast paths. Currently tracked via https://github.com/microsoft/OpenAPI.NET.OData/issues/269
The Microsoft Documentation indicates to use the GetDownloadUrl like this:
However, the GetDownloadUrl is not available.
AB#10865
Expected behavior It's expected to have GetDownloadUrl method
Client version Microsoft.Graph version 4.9.0-preview