Skip to Content

Kepsel Offline oData - How to download offline attachments

I am currently attempting to implement downloading of offline attachments with my app.

I have configured a defining request pointing to my attachments entity with retrieveStreams = true

"Attachments" : {"url" : "/zdod_i_attachments", "retrieveStreams" : "true"}

However, on initial opening of the store I receive a sync error. Checking mobile services, I can see that the app attempted to call:

<service_root> + <service_name>/<file_name>

The app appears to be attempting to download all attachments on store open. I assume I need to use the function registerStreamRequest, however I am unsure where in the application lifecycle this needs to be called and if I need to make the function call for each individual attachment

Below is a sample call:"stream",
        	"/zdod_i_attachments(incidentId=guid'" + "c4113ba7-6c91-4e6e-a816-d033e54bfcc" + "',attachmentId=guid'" + "061836cc-5e27-1ed8-beb9-30c5092e42c6" + "')",
        	sap.hybrid.onRegisterStreamSuccess, sap.hybrid.onRegisterStreamError);

Then in the success callback I trigger a refresh:

	onRegisterStreamSuccess : function(){;

How can I make sure the store attempts to call the right path pointing to the attachment entity?



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 09 at 10:04 AM


    I can see multiple questions here:

    1) Do I need to register/unregister for each attachment?

    Unfortunately, yes. This impacts the answer to 2)

    2) When to call the download of an attachment?

    Whenever you need to get it, it's up to you to decide.

    Does the .refresh() works for you and you can download and refresh the attachment?

    Note (it's boolean not string):

    "retrieveStreams" : true

    Related documentation can be found here (for other readers, you already found it)

    Hope this helps a bit.



    Add comment
    10|10000 characters needed characters exceeded