How to add attachments to workforce assignment with arcpy and arcgis workforce api?

242
0
01-12-2021 11:58 PM
RistoÜlem
New Contributor II

Hello!

I am creating workforce assingments with python and with workforce python api following this tutorial from github. I can create the assignments successfully and the assignments appear in workforce, but I can't see the attachments and I don't get any errors.

import arcpy, requests, os, sys, json, types
from arcgis.gis import GIS
from arcgis.apps import workforce

# do some stuff here, get the project and assingment types and so on
assignments_to_add = []
for stuff in stuffs:
    assignment_to_add = workforce.Assignment(project, 
    assignment_type=assignmentTypes_dict[assignmentType], status = "assigned")

    # add other nessesary thing to assignment and do some stuff here

    # add attachments
    # this doesn't work but doesn't give any error either and assignments are added to workforce without attachment 
    assignment_to_add.attachment_file = types.SimpleNamespace()
    # just tying to add one simple image from file
    assignment_to_add.attachment_file = "C:/image.jpg"

assignments = project.assignments.batch_add(assignments_to_add)

 

This is link above is only example i found with attachments, is something changed in the api?

0 Kudos
0 Replies