Which GeoProcessing Tool deletes all the Feature Class records and ALL the attachments?
Why not just delete or overwrite the feature class/attachment table in the enterprise gdb? If you're willing to truncate it, I don't imagine it matters if you keep the original or not.
Exporting the data from AGOL is really easy, and as far as I recall, it should bring over all the attachments for you.
Is the image from AGOL? I thought you could not preserve the GLOBALID when you export out of AGOL
Yes, at least with python 3, if you set the maintain attachments and preserve global id's environment variable, then the attachments will be appended with the features (as long as they are enabled on the fc also) and will retain the existing Global ID's.
I use this all the time. I published my SDE data to AGOL as hosted feature layer, have lots of editing on the AGOL version, run a script that looks at the Global ID's in my SDE data, and the AGOL data. Anything that is in the HFS, but not the SDE gets appended to the SDE so that I have a backup copy of the data, attachments and all (and, of course, one that responds much faster than any AGOL data).
This, does NOT, however, work the other way. Seems there is no 'simple' way to copy data from SDE to AGOL with the attachments.
R_
I guess the bigger question for this workflow is: Why not share it as a service from the enterprise GDB in the first place, rather than hosting it?
In my case, we don't have portal as of yet. Our 10.6.1 and 10.8.1 server, will not allow you to edit feature service without opening up to the world (and don't want public to be able to truncate/alter our data). we are using Window authentication, and ESRI tech support still can't figure out how to secure a feature service on our system.
Another big reason is for display/interaction with the data. At this point, it I want to have my images (attachments) show in the popup in web app/ex, either need to have Portal or AGOL, as they have limited the popup config with MapServices to only allow list view.
Users are used to seeing the image(s) in the popup itself without having to scroll down, click a link, open image in separate window. Among other things, but these two (mainly the first one) are work stoppers.
R_