msgraph-beta-sdk-dotnet icon indicating copy to clipboard operation
msgraph-beta-sdk-dotnet copied to clipboard

Missing GetDownloadUrl method for CaseExportOperation

Open oliveira-alexdias opened this issue 4 years ago • 7 comments

The Microsoft Documentation indicates to use the GetDownloadUrl like this:

var @string = await graphClient
	.Compliance
	.Ediscovery
	.Cases["{ediscovery.case-id}"]
	.Operations["{ediscovery.caseOperation-id}"]
	.GetDownloadUrl()
	.Request()
	.GetAsync();

However, the GetDownloadUrl is not available.

error

AB#10865

Expected behavior It's expected to have GetDownloadUrl method

Client version Microsoft.Graph version 4.9.0-preview

oliveira-alexdias avatar Aug 25 '21 19:08 oliveira-alexdias

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.

maisarissi avatar Oct 27 '21 21:10 maisarissi

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?

  • Using the workaround
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<ODataMethodStringResponse>(null, CancellationToken.None);
return response.Value;
  • 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.ConfiguredTaskAwaitable1.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.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Graph.BaseRequest.<SendAsync>d__341.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.TaskAwaiter1.GetResult() at Exports.Services.<GetDownloadUriForBrowserDownload>d__27.MoveNext() in .\Functions\Exports\Services\GetDownloadUrl.cs:line 52

  • Using HTTP Call image

oliveira-alexdias avatar Dec 14 '21 19:12 oliveira-alexdias

@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

maisarissi avatar Jan 05 '22 18:01 maisarissi

Hi @oliveira-alexdias . Are you still getting 500 using the workaround provided above?

maisarissi avatar Mar 08 '22 22:03 maisarissi

Hey @maisarissi! Now it is working as expected. Thank you.

oliveira-alexdias avatar Mar 09 '22 16:03 oliveira-alexdias

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!

maisarissi avatar Mar 09 '22 17:03 maisarissi

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

andrueastman avatar Aug 30 '22 08:08 andrueastman