Question C# to ABL again

Hi everybody,

I have again a bit of C#-code that I should translate to ABL, but I can't really figure out how.

here is the C'-code:
public static FileDownloadResult DownloadDocumentContent(this Document document) { if (document.FileDownloadRelationLink == null) document = document.GetDocumentFromSelfRelation(); var downloadResponse = document.PostToFileDownloadRelationForStreamAsync( new FileDownload() { TargetFileType = FileDownloadType.PDF }).Result; return new FileDownloadResult() { Stream = downloadResponse.Content, }; }

until now I came up with the following translation:
IF Document:FileDownloadRelationLink = ? THEN Document = Document:GetDocumentFromSelfRelation(). FileDownload = NEW DocuWare.Platform.ServerClient.FileDownload(). FileDownload:TargetFileType = FileDownloadType:PDF.

My problem ist PostToFileDownloadRelationForStreamAsync, which is descibed here: Document.PostToFileDownloadRelationForStreamAsync Method

and here especailly the expression Task<DeserializedHttpResponse<Stream>>

I have absolutely no idea of how to code this in ABL and would really appreciate any help and informaton.

TIA, Wolf
 
I'm a bit further now, I think the following statement should work:

downloadResponse = document:PostToFileDownloadRelationForStreamAsync(FileDownload):Result.

BUT: …I first have to define a Class-Varlable for „downloadresponse“. So I looked at the Docuware-documantation
(Document.PostToFileDownloadRelationForStreamAsync Method) and there I found:
Return Value
Type: Task<DeserializedHttpResponse<Stream>>

I tried this:
DEF VAR downloadResponse AS CLASS DocuWare.Services.Http.DeserializedHttpResponse.
…but I get a compile-error.

The problem is that I have no idea what „Task<……<Stream>>“ means and how I should deal with it in ABL. I think if I would be able to define this class-variable then I should be able to finish the code, because all that is left is:
contentHeaders = downloadResponse.ContentHeaders Stream = downloadResponse.Content
….and this should be easy to translate.
So if anybody has an idea or could point me in the right direction, I would be realy thankful,

Wolf
 

Osborne

Active Member
I have not used DocuWare and can only find a cut-down version available so cannot really offer much help.

But one thought I had is do you have Progress Developer Studio and if so what does Class Browser say for DocuWare.Services.Http.DeserializedHttpResponse? It will hopefully give you the code similar to the attached of what to define.

Also, just a thought regarding the statement you think may work. That could well be correct but there appears to be a NEW in the C# code so if not working try:
Code:
downloadResponse = Document:PostToFileDownloadRelationForStreamAsync(NEW DocuWare.Platform.ServerClient.FileDownload()):Result.
 

Attachments

  • ClassBrowser.png
    ClassBrowser.png
    19.3 KB · Views: 2
Top