I have a feature service that I want to overwrite using ArcMap, but that feature service has one hosted feature layer view. When I try to overwrite the existing view with ArcMap, I get the error:
ERROR: code:400, Unable to delete item. This service item has a related Service item, Bad syntax in request.
There are no joins, and both the original feature layer and the view are both set so that "Prevent this item from being accidentally deleted." is turned off and I have disabled editing, but it never works. Overwrites on services without feature layer views still work OK.
Is there a workaround so that I can still overwrite the service but not have to remove the view?
Is sync enabled on the hosted feature layer and/or the view? If so, make sure all disconnected edits are posted to the hosted feature layer and switch sync off and then try overwriting.
EDIT: According to the doc linked above, you need to overwrite the parent feature layer, not the view.
I appreciate the quick reply. But no, disconnected editing is turned off as well as editing (on both the parent feature layer and the view.) And I am overwriting the parent, not the view. I am using ArcMap 10.4.1 if that matters. I have since tried deleting the view, after which I can successfully overwrite the service again.
EDIT: I've done more testing today with this, and it's hard to pin it down. Definitely if you try to overwrite the parent with editing on the view enabled, it fails. But this morning, even if I cleared the settings on the view after that failure, it would still fail. Later on today though, it seems as long as I go back and turn off editing on the view, overwrite works fine no matter what settings are turned on in the parent.
I encountered this problem today as well. I was trying to overwrite a feature service that did not have sync enabled, but had a layer view that did. To resolve the issue I had to delete all replicas that existed on the view layer using /unregisterReplica. No issues after that.