web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Attach Email Attachmen...
Power Automate
Unanswered

Attach Email Attachments to Existing SharePoint list item - ItemId issue

(0) ShareShare
ReportReport
Posted on by 60

Good morning.

We have a process using two FLOWS.  User completes a Microsoft Forms Survey, First FLOW populates data into a SharePoint List and sends an email (using email entered into a survey question) to the user with the Subject line reading: "Confirmation of your submission: 24".  The number in this email is generated by SharePoint and stored in the list referenced in the upcoming flow.  The user replies to this email with resume attached (email goes to our jobs@ shared email).  When the email is received into the shared email, the second FLOW should attach the resume to the associated item in the SharePoint list.  This process was working and now is not.  It appears the Second FLOW is failing because the ItemID cannot be found in the SharePoint list.  The number in the SharePoint list in this example is 24, as is the number in the subject line of the email.  However, the number being searched for is '4'.  I don't know why it is pulling this value as the itemid.  Can you help me?  See screens to follow, FLOW was built using the reference: https://www.c-sharpcorner.com/article/no-code-solution-using-office-365-apps-and-utilities/  It worked beautifully for  testing.WhenNewEmailArrives.pngInitializeVariable.pngInitializeVariable-expression.pngSaveAttachment-AddAttachment.pngEmailUserWeAreReviewingInfo.pngRunResultFail.pngRunResultInitializeVariableValue.pngSPListItem24.png

Categories:
I have the same question (0)
  • krootz Profile Picture
    458 on at

    @tdbishop looks like your expression to get the itemID from the subject is the culprit. I can't see the entire expression, but if the subject always starts with "Confirmation of submission: xx", the below is the simplest expression to extract the itemID:

    replace.png

  • tdbishop Profile Picture
    60 on at

    just an FYI - The expression in Initialize Variable for the Value is below.  it was looking at the subject to pull the item id out of it.

    substring(triggerBody()?['Subject'],add(length(triggerBody()?['Subject']),lastIndexOf(':',triggerBody()?['Subject'])),mul(lastIndexOf(triggerBody()?['Subject'],';'),-1))
     
    The subject is 'Confirmation of submission: ' and the number changes based on the sharepoint itemid as each row from prior FLOW is inserted into list.
  • tdbishop Profile Picture
    60 on at

    So modifying per your suggestion gives me the output I am looking for.  It gives me 24.  YAY!  So, I am not sure where to go from here.  My Apply to each is failing because of invalid variable operation. because the input of workflow run action 'Add_attachment' of type 'OpenApiConnection' are not valid.  The variable ItemId must be initialized before it can be used inside 'Add_attachment'.      

     

    I guess it would have been helpful for you to know that I don't have a TON of experience with FLOW.  Just figuring it out.  My guess is that I need to do a Get Items where the value of the output = the itemid in the list? and then do the attachment?  🙂  thanks for the help.

     

  • Verified answer
    krootz Profile Picture
    458 on at

    @tdbishop at the top of your flow is where you initialize your ItemID variable with a blank value,

    then inside the apply to each is where you "set" the ItemID variable using the expression to extract the ID from the subject.

    lastly on the add attachment action, you just use the variable as the dynamic content for the ID

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard