Attachment Download

HI – I am having trouble opening file when I duplicate this business object and method call. When I trace the “View” button from attachment, I can see following business object method calls and I tried to duplicate it.

Here is tracing from clicking on “View” from attachment tab…
Ice.Proxy.BO.AttachmentImpl
DownloadFile

My test code is
Ice.Proxy.BO.AttachmentImpl attch = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.AttachmentImpl>((Ice.Core.Session)oTrans.Session,Ice.Proxy.BO.AttachmentImpl.UriPath);
attch.DownloadFile(35);

I am able to successfully duplicate the business object call and method calls and I see it on my tracing. But actual file never opens. Nothing happens…

You have to open the file after it has been downloaded, I’m assuming the file is being downloaded somewhere after this method call?

Does this code have a return value? If it’s the actual file object, you may be able to open the file using the default viewer for the file.

Dear,

Do you get any solution ?

1 Like

@dmila were you able to fix this? I’m trying to do the same but got an error about invalid path

What attachemt are you trying to use? DocStar?

Hello @Olga yes a DocStar file is the one I’m trying to download by custom code. What we want to do is to download the file (it is going to be a CSV), copy it and do some additional logic based on it.

Thanks

Did you try the DocStarDownloadFile method?

2 Likes

yes, DocStarDownloadFile will return byte array that you can save in some temporarry file using File.WriteAllBytes(fileName, byteArray);

1 Like

Awesome thank you @Olga and @danbedwards!! It worked :slightly_smiling_face:!

1 Like