Hi Jonah - yes thanks. And yes, that's what I thought as well re SD files. I'd never read anywhere about a size limit for those. Yes, the largest attachment (in this case pdf's) is about 9.5Mb. I like to work in the IDLE for Pro - here is a snippet of my code:
def stageSDDraft(mp,lyrName,summary,lyrs,descript,folder,tags,sdfolder):
sddraft_out = "C:/ArcProProjects/PortalUpdates/" + sdfolder + "/" + lyrName + ".sddraft"
draft = mp.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", lyrName, lyrs)
draft.portalFolder = folder
draft.tags = tags
draft.summary = summary
draft.description = descript
draft.overwriteExistingService = True
draft.exportToSDDraft(sddraft_out)
return
try:
portal = arcpy.SignInToPortal("https://ags3.myorg.net/portal", "userName_portal", "userNamePw")
aprx = arcpy.mp.ArcGISProject('C:/ArcProProjects/PortalUpdates/PortalUpdates.aprx')
for m in aprx.listMaps("FloodAttachments"):
print("Map: " + m.name)
for lyr in m.listLayers():
desc = arcpy.Describe(lyr)
if lyr.name == 'ElevationCertificate':
print(lyr.name)
lyrList = []
lyrList.append(m.listLayers(lyr.name)[0])
stageSDDraft(m, lyr.name, "The Elevation Certificate point layer contains the addresses of homes and businesses that have a documented finished floor elevation that is above the Effective \
FEMA designated base flood elevation.",lyrList,"The Elevation Certificate point layer contains the addresses of homes and businesses that have documented finished floor elevation \
that is above the Effective FEMA designated base flood elevation. The certificate is accessed as a layer attachment.",
"EnvironmentalLayers","Cadastral,Environmental,Services","Environmental")
print(lyr.name + " Draft Created")
arcpy.StageService_server('C:/ArcProProjects/PortalUpdates/Environmental/' + lyr.name + '.sddraft', 'C:/ArcProProjects/PortalUpdates/Environmental/' + lyr.name + '.sd')
print(lyr.name + " Service Staged")
arcpy.UploadServiceDefinition_server('C:/ArcProProjects/PortalUpdates/Environmental/' + lyr.name + '.sd', 'My Hosted Services', "","","","","","OVERRIDE_DEFINITION","SHARE_ONLINE","PUBLIC",
"SHARE_ORGANIZATION","")
print(lyr.name + " Service Uploaded")
message = message + "\n" + "1. " + (lyr.name) + " Service Uploaded"
It's pretty straight-forward. However, you are probably right about there being another issue. I have been overwriting this feature layer weekly for a couple of years because of how the attachments are constructed.
The attachments are pulled in from another system of record and then we use a GP to dump them into another directory before attaching them to the points via a match table.
I am going to try setting this up with a new layer, new SD file, etc and see it works.....