Prepend string to filenames in Attachments control

  • Prepend string to filenames in Attachments control

    Posted by DSC Communities on February 20, 2020 at 8:50 am
    • Paul Van Beek

      Member

      February 20, 2020 at 8:50 AM

      Hi, I’m working on a new app that is connected to a SharePoint list. The previous iteration of this process used an InfoPath form with repeating tables to track comments tagged by date, basically creating a conversation regarding the item. In addition, a repeating table was provided for adding attachments separated by date. I’ve been able to manage the comment/conversation aspect by prepending each comment with the date and username and appending them to a multiline text field. I’m struggling to find a way to modify the names of files added to an attachments control to reflect the date uploaded before they save. I’ve tried putting them in a collection and patching the collection, but even though the collection showsĀ  Name and Value columns, the Patch statement says the ‘Name’ column does not exist in the collection.Ā 

      Thoughts on how to make this possible?

      Thanks.

      ——————————
      Paul Van Beek
      ——————————

    • Brian Ramsey

      Member

      February 20, 2020 at 11:21 AM

      I don’t believe it is supported in PowerApps however you should be able to accomplish by calling a PowerAutomate (Flow)
      https://powerusers.microsoft.com/t5/Building-Flows/How-to-rename-SharePoint-list-attachment-file-name-or-append-the/m-p/304894

      ——————————
      Brian Ramsey
      Cloud Infrastructure Architect
      ——————————
      ——————————————-

    • Peter Heffner

      Member

      February 21, 2020 at 2:51 AM

      Hi Paul, As Brian mentioned Power Automate would be the best way.

      Is there a reason you go for attachments and not upload files in a SP library?

      Check also this videoĀ https://www.youtube.com/watch?v=3QaiM8SeWfMĀ for more details on file upload in PA.

      ——————————
      Peter Heffner
      Intranet Solution Specialist III
      ——————————
      ——————————————-

    • Paul Van Beek

      Member

      February 21, 2020 at 8:27 AM

      As I said above, each InfoPath form was used almost as a conversation about an item, with additional comments and attachments being date stamped. I’m trying to come close to that same idea within a Power App, and storing the documents in a secondary library increases the complexity of managing that conversational relationship. Attaching and storing the items incrementally is fairly straightforward; providing some indication of when the files were added is the difficult part as I’m trying to automate entry as much as possible for the end user and not require them to enter a descriptive text to indicate they added a file. .

      ——————————
      Paul Van Beek
      ——————————
      ——————————————-

    • Brian Scott

      Member

      February 21, 2020 at 8:36 AM

      Would the date have to be part of the name? Couldn’t you create another field to hold the date or the date and name and use that field to sort on?

      ——————————
      Brian Scott
      Chief Creative Officer
      Concord NC
      ——————————
      ——————————————-

    • Paul Van Beek

      Member

      February 24, 2020 at 8:54 AM

      We’re trying to use the date string in the filename to track when each file was uploaded without requiring separate entry in another field.

      ——————————
      Paul Van Beek
      ——————————
      ——————————————-

    • Brian Scott

      Member

      February 24, 2020 at 9:16 AM

      You wouldn’t need another entry – powerapps can create the entry automatically

      ——————————
      Brian Scott
      Chief Creative Officer
      Concord NC
      ——————————
      ——————————————-

    • Paul Van Beek

      Member

      March 2, 2020 at 12:36 PM

      Sorry, been out battling illness for a bit. Here’s what I came up with.Ā 

      1. The item is updated through a form Submit on the datasource.
      2. The notes field Update value is a text variable that inserts the date and user id of the person makingĀ  the changes or adding the item before the text added.Ā 
      3. The file attachments are not captured to an Attachment control, but to a collection using an Image control based on the process outlined here:Ā https://powerusers.microsoft.com/t5/Building-Power-Apps/Attachment-Control-Get-File-Content-OnAddFile/m-p/350375/highlight/true#M100491

      4. OnSuccess for the form submit, the attachments are pulled into a collection and, using a ForAll, the items are processed by calling a Flow and passing the ID from the Form LastSubmit, the filename, file contents and ID of the user making the changes.
      5. The Flow composes the filename with the date and user id prepended andĀ  attaches each file to the list item.Ā 

      By adding the name and date to each note and attachment, it provides a quick visual history to the progression of the conversation items on the subject in question. Thanks all for the ideas and thoughts. Notes and attachments can be added independently with a quick visual reference to when each item was added.

      Paul

      ——————————
      Paul Van Beek
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Prepend string to filenames in Attachments control’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!