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 Automate
Unanswered

Flow to Create File

(3) ShareShare
ReportReport
Posted on 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.

Categories:
I have the same question (0)
  • Verified answer
    v-monli-msft Profile Picture
    on at

    Hi audrieg,

     

    I reproduced the issue:

    Capture.PNG

     

    I think this is because that flow treat "File Content" field as a whole exsiting file. I mean that if you got a file in the trigger, then you put this trigger file content into this "File Content" field in SharePoint create file action, this will create a correct file and you can open it in SP.

    Capture1.PNG

     

    Regards,

    Mona Li

  • v-monli-msft Profile Picture
    on at

    See above.

     

    Moan Li

  • audrieFCT Profile Picture
    987 on at

    I love your idea, but I don't see FileContent as a tag in my UI. I typed it but I don't think that's what you mean.

     

    FileContentMissing.PNG

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi,

     

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

     

    Thanks

  • audrieFCT Profile Picture
    987 on at

    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,865 Most Valuable Professional on at

    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

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    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

  • audrieFCT Profile Picture
    987 on at

    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,865 Most Valuable Professional on at

    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 at

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

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