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

Community site session details

Session Id : vAF3i2cejKmNJDqrdEhDhp
Power Automate - Building Flows
Answered

Flow to Create File

Like (3) ShareShare
ReportReport
Posted on 10 Nov 2016 10:28:38 by 987

Environment details: Sharepoint in Office 365 - creating the Flow from the List Ribbon in the new Modern Experience.

 

When I use the template "When a new item is added in SharePoint, complete a custom action" to create a file in a SharePoint Library, it does not seem to allow me to select a Content Type at the library destination. Is it possible to specify the content type to be used?

 

I didn't specify one, and yet, it did not pick up the default content type either - it created a file without an extension. (I guess that means I need to add the extension in the file name area, right?)

 

screenshot.PNG

 

Here is the updated flow with the extension added. The file is created (default content type picked up) but the new file can not be opened.

 

flow.PNG

 

sessionID.PNG

 

If I click "Edit in Word" - it opens the file blank (even though the template has preformatted placeholders).

 

Creating a default file using the New command opens the template with preformatted text.

I have the same question (0)
  • man-verma Profile Picture
    2 Microsoft Employee on 18 Dec 2020 at 11:15:16
    Re: Flow to Create File

    Try using below expression for file name:

    concat(variables('ID'),'Invoice.docx')

  • grhsVman Profile Picture
    33 on 10 Jul 2020 at 19:39:49
    Re: Flow to Create File

    How is this the solution? Maybe I missed it, but I don't see the answer to the question, "how is the File Content created?"

     

    @v-monli-msft 

    @audrieg 

  • Community Power Platform Member Profile Picture
    on 21 Aug 2017 at 15:08:31
    Re: Flow to Create File

    I'm getting this same error. Can the "File Content" be the content of a file other than the source file that is the trigger which creates the file?

  • audrieFCT Profile Picture
    987 on 14 Nov 2016 at 15:30:40
    Re: Flow to Create File

    Yes, and I tested that I can add an attachment manually without issue (I believe that is default unless you turn it off).

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 14 Nov 2016 at 10:36:22
    Re: Flow to Create File

    Hi,

     

    Thanks for the BIG KUDOS Smiley Happy Can you please check your List settings > Advanced settings > Attachtment to list items are enabled or not?

     

    Thanks

  • audrieFCT Profile Picture
    987 on 14 Nov 2016 at 01:26:07
    Re: Flow to Create File

    I give you BIG KUDOS for such a great idea! Only, even if it works I can't use it. I need to create a file based on a template (and I can't set a template for a list attachment). Let me know if I'm wrong....but without being able to specify a content type the attachment approach won't work. (I did put this in my idea journal....cause I will go back to it if/when they add Content Type to the Create File options in Flow.

     

    Update: For some reason FileContent is not available for attachments either.

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 13 Nov 2016 at 21:58:36
    Re: Flow to Create File

    Hi,

     

    I think this might helps. So for every lists there is an 'Attachments' in SharePoint. Try to set the following in Create File Flow

     

    Site URL:
    Your SP Site

     

    Folder Path:
    /List/YourListName/Attachments

     

    Filename:
    Set the Filename

     

    FileContent:
    Set the File Content

     

    Please let me know how it goes?

     

    Thanks

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 13 Nov 2016 at 19:14:01
    Re: Flow to Create File

    Hi,

     

    You mentioned "I never have this problem when I create a new file using the "New" command directly in the library in the UI".

     

    So here are you creating the title first and attach the file?

     

    Thanks

  • audrieFCT Profile Picture
    987 on 13 Nov 2016 at 13:59:53
    Re: Flow to Create File

    Yes, and no. Smiley Happy

    It has to do with the fact that I'm not starting with a library, I am initiating the flow from a list.

    What I also found out is that the same 'bug' occurs when I try to create the file using SharePoint Designer (which does have a way to specify the content type name).

     

    So, I revised my flow to start by copying a template file from one library to the destination library (since that file already has content I thought that would get me that "FileContent" tag - but alas it doesn't. Flow copies over the file, but I get the same error message - it appears the file is corrupting on creation.

     

    Any ideas of what I might be able to do to get a new file in a library (I'm ok with it being based on the default content type since there is only one in the library. Do you think it could be becaue the template is customized? (It has headers and footers for company branding.)

     

    FYI: I never have this problem when I create a new file using the "New" command directly in the library in the UI....only when I try to create it from a workflow method external to that library.

     

    Appreciate any ideas...

     

     

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 12 Nov 2016 at 22:01:48
    Re: Flow to Create File

    Hi,

     

    This might be something to do with your SharePoint list library type?

     

    Thanks

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading started
Loading complete