Enterprise Survey123 photo transfer Microsoft Power Automate

559
4
05-02-2022 02:37 PM
Michael_VanHatten
New Contributor III

Hello,

I am currently using Microsoft Power Automate (PA) to move tabular data from a Survey123 published through enterprise. This works well with custom expressions for each attribute. I am trying to pull photos submitted with the surveys and dump them into a OneDrive folder. My issue is that PA does not give me the dynamic content calls for my photos in the survey. When trying to follow the instructions outlined here https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-working-with/bc-p/... I am unable to direct the URL to the photo, as there is no dynamic content for my attached photos. 

I tried to call the photos with a similar expression as all my other feature attributes I have in the survey but I am not having luck here is the expression.  triggerBody()?['feature']?['attachments']['inspect_photos']

 

Has anyone successfully moved photos from an Enterprise Survey123 through PA? 

 

Thanks

0 Kudos
4 Replies
TL2
by
Occasional Contributor III

I am able to grab my attachments and place them in an email, I'm sure you could do the same into a folder.

Did you initialize an array variable for your photos?

TL2_0-1651528649899.png

TL2_1-1651528675049.png

 

0 Kudos
Michael_VanHatten
New Contributor III

Are you using an Enterprise Connection? If so how are you calling your attachments (photos) I get no dynamic content for any attachments or photos I am trying to write a expression to call my photos but that is not working for me. 

0 Kudos
TL2
by
Occasional Contributor III

I have a 'feature attachments' dynamic content option.  This will not appear in the email attachments field, it will only appear as an option when setting up an array because it is can contain multiple values.  You must initialize an array from 'feature attachments'

Side note, I have found the enterprise connection to be very janky and often disconnects from portal.  I have about 4 connections because I often had to create a new connection to reconnect the survey.

0 Kudos
RobertBorchert
Frequent Contributor III

Not certain if this will  help. I had a project were the Field Crew Lead wanted all photos taken transferred to to a specific drive.  This script would copy all attachment's and transfer them to a directory on my C: drive

For the inTable  you will want to change database name to your specific database name. Essentially making a path direct to the attachments table. 

I saved this as a python script so I could run it every Monday.  I don' t know if you will be able to plop them direct into a One Drive folder but you could send them to your C: drive and then combine the script in a .bat file to copy them direct to One Drive. 

However, all that aside.  You should try to convince the end users to use a Dashboard 

 

import arcpy
from arcpy import da
import os

inTable = "Database Connections\\<database name>.sde\\GIS.SitePhotos_WORKGROUPS__ATTACH"
fileLocation = "C:\Photos700\ExtBTS"

with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
for item in cursor:
attachment = item[0]
filenum = str(item[-1]) + ".jpg"
filename = filenum
open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
del item
del filenum
del filename
del attachment