Use Power Automate to create a folder in SharePoint with link back to Microsoft Lists (UPDATED)

Check out this related flow pattern on the Power Platform Samples repository: https://github.com/pnp/powerautomate-samples/tree/main/samples/create-folder-with-link-back-to-list

In this blog post I will out line how Power Automate can be used to create a folder in a SharePoint document library and then store the link to the newly created folder inside of Microsoft Lists. I have used this pattern numerous times for business processes where transactional metadata and document storage are required. For example, a case management list stores the business process data and the folder stores the supporting documents.

I am using a list called “Exchange Agreements” in this blog post. You can replicate this Exchange Agreements using the my spreadsheet (see below) and these instructions: Microsoft Lists: new list using an existing Excel spreadsheet

Let’s start by adding a new “Hyperlink” column to the Exchange Agreements list called “FolderLocation”.

Create a column

Create a new Flow from by clicking “Automate” > “Power Automate” > “See your Flows”.

See your Flows

Create a new “Automated – from blank” Flow.

New automated Flow

Provide a name for the Flow i.e. “Exchange Agreements – New”; select the “When an item is created” SharePoint trigger and then click “Create”.

SharePoint when an item is created

Set the “Site Address” and “List Name” to you target site and list.  

SharePoint when an item is created

Click “New step”, search for “Variable” and select the “Initialize variable” action. Set the “Name” to “varFolderName” and “Type” to “String”.

“Value” should be set to something unique, readable and short. In my demo, I combine school name and exchange type for a value of “University of South Australia (Undergraduate Programs)”.

Power Automate expressions and the concat function work well in these situations. Here is the expression I use:

concat(triggerOutputs()?['body/Title'], ' (', triggerOutputs()?['body/ExchangeType/Value'], ')')

Initialize variable

Click “New step”, search for “SharePoint” and select the “Create new folder” action.

Set the “Site Address”, “List or Library” to you target site and document library, and “Folder Path” to “varFolderName”.

Create new folder

At this point the folder has been created and now we have to update the list with the URL path to the folder.

Click “New step”, search for “SharePoint” and select the “Send an HTTP request to SharePoint” action.

Set the “Site Address” and “List Name” to you target site and list. 

Also set:

  • “Method” to “POST”
  • “Uri” to “_api/web/lists/GetByTitle(‘Exchange‘)/items(ID)
    • Where ‘Exchange’ is the list name and ID is the “ID” from the SharePoint “When an item is created” action
  • “Headers” – switch to text – to:
    {
    “Content-Type”: “application/json;odata=verbose”,
    “X-HTTP-Method”: “MERGE”,
    “IF-MATCH”: “*”
    }
  • “Body” to:
    {‘_metadata’: {‘type’:’SP.Data.ExchangeListItem’},’FolderLocation‘: {‘Description’: ‘varFolderName‘, ‘Url’: ‘LinkToItem‘}
    }
    • Where Exchange is the list name; FolderLocation is the column name; varFolderName is the variable and LinkToItem comes from the “Create new folder” action.

My completed Flow looks like the image below:

My completed FLow

Save your Flow and test by submitting a new item to your list. If all goes well the new folder will be created and a link to the folder will be added to the list item.

Folder created
List item with folder link.

This pattern can be beneficial for large volume lists and folders. The folder location URL serves as a simple pointer to the supporting documents and negates the need for the user to search or navigate to the folder.

Thanks for reading.

NY

78 thoughts on “Use Power Automate to create a folder in SharePoint with link back to Microsoft Lists (UPDATED)

  1. Great and valuable blog which will add huge business process benefits!
    Question – off topic – if you have a Microsoft List created can you adjust power automate to send emails to line managers and customers so for example power automate can send a bulk email which includes 3 of 4 items in the list which require them to action?
    At the moment I have setup power automate to send emails per individual item. Managers want 1 email alert not 3 or 4 emails per item on the list.

    Like

    1. Hi Amardip,

      Yes, you can set up a message with multiple items. The key to the solution is that the message body needs to be compiled before the send mail message action executes. This sounds like a great idea for a future blog post.

      Thanks for reading!

      Norm

      Like

  2. Hi, this is very helpful, but I am getting stuck on the last step. I am getting the error “An entry without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.” I did exactly what was specified above. I’m not able to post a screenshot here it seems…

    Like

    1. Hi MarRayn,

      Check that the ExchangeType is populated with a valid entry. The ExchangeType is part of the variable definition and ultimately becomes the folder-link name.

      I’m happy to help further and thanks for reading.

      NY

      Like

  3. Thank so much for your reply! In my version, I had to replace “exchange type/value” with “title”. So, my variable is: concat(triggerOutputs()?[‘body/ID’],’_’,triggerOutputs()?[‘body/Title’]). I was able to create a file name that is “ID_Title”.

    I’ve been able to narrow down the issue to something wrong with the Uri or body of the “send http request to SP”:

    Body:
    {‘_metadata’: {‘type’:’SP.Data.Sales-Training-Development-RequestListItem’},’Link1′: {‘Description’: ‘@{variables(‘varFolderName’)}’, ‘Url’: ‘@{outputs(‘Create_new_folder’)?[‘body/{Link}’]}’}
    }

    The list name is “Sales-Training-Development-Request”. “Link1” is a hyperlink column in my list. I’ve also tested with a second column, “Link2”, which is a one-line text field and wasn’t successful with either.

    I was also having some trouble with my Uri, but I thought I managed to fix it:

    _api/web/lists/getbytitle(‘Sales-Training-Development-Request’)/items(‘@{outputs(‘Create_new_folder’)?[‘body/ID’]}’)

    Thank you for any insight you can provide! I appreciate you taking a look at this!

    MR

    Like

    1. Hi MarRayn,

      You are missing an underscore on metadata. “_metadata” should be “‘__metadata”.

      Test and let me know how you make out.

      NY

      Like

  4. Hi Norm,

    Trying to do as described.

    I am having trouble getting the API call Uri” to work
    The expression “web/lists/GetByTitle(‘MDSNET21_CUSTOMER_PROJECTS‘)/items(99)” is not valid.
    clientRequestId: 4b44b4c6-9e66-439d-8651-dac79c3ca318
    serviceRequestId: 5ba8b09f-5068-2000-9324-ede1db259587

    Where MDSNET21_PROJECT_LIST is the list where i want to add the URL and the ID is the correct one
    I Cannot find out why flow fails

    Question : when someone changes the name of the list to something else, it will not work anymore, because the name is hardcoded?

    Like

    1. Hi Wilfried,

      Check your single quotes and ensure that they are ‘ and not ‘. WordPress is messing up my code formatting.

      Thanks for reading!

      NY

      Like

  5. Hello! This looks like what I need but I need to both create the list AND the folder structure at the same time. Since I’m not that experienced at Power Automate, do you have any particular guidance you can provide or pointers I need to keep in mind.
    Thank you.

    Like

      1. Thanks you for your very kind reply, Norm.

        I have an excel list of 600 topics that I’d like to import. Of course, the new list imports fine and has some metadata I’d like to keep. Account name; account number; owned by; classification etc.

        Whether during the import OR afterward, I need to add the new folders to the document library and then update the imported list with the link. I’d like to concatenate the account name and account number as the new folder name.

        I read the instructions and they are Greek to me. Do have have an example of carrying out such a task or how shall we proceed?

        Like

      2. Hi Cindy,

        This is definitely possible and the Flow pattern in this blog post can be used as a reference point. The major difference is you are running this Flow in batch and will require a different trigger (i.e. Scheduled) and a listing or rows to process (i.e. SharePoint get items and a loop).

        I’m happy to help you with this Flow if you like.

        NY

        Like

  6. Hi – I tried your “Send an HTTP request to SharePoint” but could not get it to work. I found a much easier way with “Update item” – so simple it was crazy after spending about 3 hours trying your way.

    Like

    1. Hi Fiona,

      Sorry to hear that you couldn’t get it to work. The syntax is very particular and I know I have had similar “3 hours trying”. My preference for this Flow would have been to use the Update item action but at the time of developing this pattern adding a hyperlink with a description was not supported and as far as I know, it is still not supported. How did you do it?

      Thanks for reading!

      NY

      Like

      1. Hi Norm,

        I followed your steps to where you said “At this point the folder has been created and now we have to update the list with the URL path to the folder.” I then used Update Item for my list and then used the Dynamic Content from the Create Folder step to add the URL for the folder to my list which had a column set up for the URL link.

        Like

      2. Hi Fiona,

        Were you able to add a link description? Last I checked that wasn’t an option. In my Flow pattern, the link to the list item is the school name.

        Thanks.

        NY

        Like

      3. Hi Norm,

        I didn’t need to add a link description as the description was in the Description column of the List.

        Like

  7. Hi Yassine,

    After I had created the folder with VarFolderName being I then simply created another variable for the link. So it was just a matter of getting the same naming logic for creating the folder as creating the URL.

    Name: SupportDocsLink
    Type: String
    Value: https://tenantname.sharepoint.com/sites/Contracts/SupportingDocs/

    And then used the output from this step and added to the “hyperlink” column in the list item.

    Hope this helps.

    Like

  8. Hello Norm,

    thanks for the good article.
    I would like to create the new folder, in a subfolder of “Documents”, something like: Documents/General/Newfolder.
    Is this possible?

    Thanks

    Like

    1. Hi Simone,

      Yes, that is possible and can be as simple as adding /General to the path in the create folder action. If you need to do this dynamically (i.e. Teams) then it’s a bit more work. Check out this post to see how involved it can be for dynamic Teams SPO site URL retrieval.

      Thanks for reading!

      NY

      Like

      1. Thanks Norm. That´s solved.
        I can create the folder but I get stack on the link.

        the expression “web/lists/GetByTitle(‘PipelineSRC‘)/items(91)” is invalid.
        clientRequestId: 2d5f4e2e-a518-45af-b3d9-9e9f3c98a63b
        serviceRequestId: db5fc49f-b056-b000-fd7b-199745ba29fc

        “errors”: [
        “-1”,
        “Microsoft.SharePoint.Client.InvalidClientQueryException”

        This is the Input:
        _api/web/lists/GetByTitle(‘PipelineSRC‘)/items(@{outputs(‘Create_new_folder’)?[‘body/ID’]})

        PipelineSRC: is the list name.

        Like

      2. Hi Simone,

        Assuming there are no syntax errors, especially with “__metadata” and single quotes, check the internal list name by adding this to the URL:

        /_api/Web/Lists/GetByTitle(List Name here’)?$select=ListItemEntityTypeFullName

        Let me know how you make out.

        NY

        Like

  9. Hello again Norm,
    Still no chance at the moment.
    I changed “_metadata” to “__metadata” and use this ‘ everywhere.
    I have added the string as you have proposed and I get this:

    The expression “web / lists / GetByTitle (‘PipelineSRC’) / items (139) / _ api / Web / Lists / GetByTitle (PipelineSRC ‘)” is not valid.
    clientRequestId: 0f2d29d6-5629-4baf-b334-42b2fffefbc0
    serviceRequestId: f1dbc49f-c009-b000-fd7b-17bfc4dc85d4

    This is the input:
    {
    “host”: {
    “connectionReferenceName”: “shared_sharepointonline”,
    “operationId”: “HttpRequest”
    },
    “parameters”: {
    “dataset”: “https://xxxxxxxxxxxxxxx”,
    “parameters/method”: “POST”,
    “parameters/uri”: “_api/web/lists/GetByTitle(‘PipelineSRC’)/items(139)/_api/Web/Lists/GetByTitle(PipelineSRC’)?$select=ListItemEntityTypeFullName”,
    “parameters/headers”: {
    “Content-Type”: “application/json;odata=verbose”,
    “X-HTTP-Method”: “MERGE”,
    “F-MATCH”: “*”
    },
    “parameters/body”: “{‘__metadata’: {‘type’:’SP.Data.PipelineSRCListItem’},’Folder’: {‘Description’: ’29_folder name’, ‘Url’: ‘https://xxxxxxxxxxx//29_folder name’}\n}”
    }
    }

    Any input would be appreciated.

    Like

  10. Hi Norm, great article! Are you perhaps aware if it is possible to create a link for accessing the folder through the teams tab? I’m having a list inside a teams channel, where creating item triggers a PA flow that creates a folder in the library and then creates a Sharepoint folder sharing link for that folder and pastes it back into the list. The problem is it’s a link to a folder in a sharepoint site instead to the same folder through a teams tab. The thing is I need guest users to be able to work on list items and documents through teams UI, and switching to Sharepoint is confusing for them and requires additional fiddling with access rights. Am I asking too much from the big MS? 🙂

    Like

    1. Hi Alijaz,

      Thanks for the feedback, I appreciate it. You pose a great question. The out-of-the-box functionality does not allow the folder to be opened in the Teams Files context BUT I wonder if this could be created. Let me think about this one and explore options! More to follow.

      Thanks for reading!

      NY

      Like

  11. Hi Norm,

    Great article and exactly what I was looking for but I am stuck on the last part

    The Uri is

    _api/web/lists/GetByTitle(‘Issue’)/items(@{outputs(‘Create_new_folder_-_Issue_(New_Folder)’)?[‘body/ID’]})

    Headers
    {
    “Content-Type”: “application/json;odata-verbose”,
    “X-HTTP-Method”: “MERGE”,
    “IF-MATCH”: “*”
    }

    Body

    {‘__metadata’: {‘type’:’SP.Data.IssueListItem’},’Folder’: {‘Description’: ‘@{variables(‘varFolderName’)}’, ‘Url’: ‘@{triggerOutputs()?[‘body/{Link}’]}’}
    }

    but I get an error

    Error
    Action ‘Send_an_HTTP_request_to_SharePoint__-_Issue_(Folder)’ failed
    Error Details

    Item does not exist. It may have been deleted by another user.
    clientRequestId: 57987024-e3f8-44ca-8893-35c24771d9a9
    serviceRequestId: c210d19f-e04f-c000-476c-08022f0f6b00

    Like

    1. Hi Joe,

      Is your list name Issue and column name Folder? The Url should be “Link to item”.

      Thanks for reading!

      NY

      Like

      1. Yes sir

        The list name is issue and column is folder. I have worked on this all weekend and I am stumped

        Like

  12. Hi Norm

    Any ideas what can be causing my issue

    I completely started over creating a new Issue Tracker list called Issue tracker. The folder Column is Folder and I still get the same error

    Item does not exist. It may have been deleted by another user.
    clientRequestId: 8225d09a-0989-4a91-b0c2-1d61a9f97b49
    serviceRequestId: 7432d29f-200d-c000-2cd8-d1cd3a7b95d6

    The Body is setup like this

    {‘__metadata’:
    {‘type’:’SP.Data.Issue_x0020_trackerListItem’},’Folder’: {‘Description’: ‘@{variables(‘varFolderName’)}’, ‘Url’: ‘@{outputs(‘Create_new_folder_-_Issue_Tracker_(Folder)’)?[‘body/{Link}’]}’}
    }

    The headers like this

    {
    “Content-TypeMERGE”: “application/json;odata=verbose”,
    “IF-MATCH”: “*”,
    “X-HTTP-Method”: “MERGE”
    }

    and the Uri like this

    _api/web/lists/GetByTitle(‘Issue tracker’)/items(@{outputs(‘Create_new_folder_-_Issue_Tracker_(Folder)’)?[‘body/ID’]})

    It creates the folder as intended but fails on the final step of bringing back the link

    Like

    1. Hi Joe,

      The message sounds like it can’t find the ID of the List item. Try hard coding the List ID value into the URI section of the Send an HTTP Request to SharePoint.

      If you direct message me with screen shots etc I can help further.

      Thanks and sorry to hear that its not working.

      NY

      Like

      1. Hi Norm,
        I see Joe is having the same issues I am having with the folder location not creating. Were you able to get a resolution for this?

        Thanks
        Javier

        Like

      2. Hi Javier,

        I did not hear back from Joe to know how he made out. If you send me the list details and error message I will be happy to help further.

        Thanks for reading!

        NY

        Like

  13. Sorry Norm been crazy at work. I was able to resolve it and really I think it comes down to how its put together.

    In my headers i changed it to this
    {
    “Accept”: “application/json; odata=verbose”,
    “IF-MATCH”: “*”,
    “X-HTTP-Method”: “MERGE”,
    “content-type”: “application/json; odata=verbose”
    }

    URI Section
    _api/web/lists/getbytitle(‘Cash%20Research’)/items(IDUSEDINCASHRESEARCH)

    In the body I did it exactly like this

    {‘__metadata’: {‘type’: ‘SP.Data.Cash_x0020_ResearchListItem’},
    ‘FolderLocation’: {‘Description’: ‘varFolderName’, ‘Url’: ‘LINKTOITEM’}
    }

    That did the trick

    Liked by 1 person

  14. I also did some interesting adding to this Flow. We use this as a easy way to track some cash shortages taking place and reporting our research. So in our case we have a few people using this list. A few things to make note and what we added on.

    Our Sharepoint site is a private group of 9 people but we assign these tickets out over 4600 locations and 10,000 possible people that will conduct the research. Each person would need access to the files we put in that folder. So I added to the flow to give access to that folder only to people who are not members of out private group.

    An email is sent explaining the ticket to the person reviewing the ticket as well as explaining they have been granted access.

    Because of the email portion you’ll want to make sure everyone with access to this list has a separate copy of the entire flow or use a shared email box to avoid errors.

    We also report out to a few other teams who use our data for various reports including Power BI. Because of this we also added the ability for this flow to go further and add a line to a CSV file stored in a different folder on our Sharepoint every time we add a new ticket.

    Like

  15. My flow is stopping at the last step.
    That’s my body field.

    {‘__metadata’:{‘type’:’SP.Data.DASHBOARD’},’FolderLocation’:{‘Description’:’@{variables(‘varFolderName’)}’,’Url’:’@{outputs(‘Criar_nova_pasta’)?[‘body/{Link}’]}’}

    Error
    Action ‘Send_an_HTTP_request_to_SharePoint’ failed
    Error Details:
    The item does not exist. It may have been deleted by another user.
    clientRequestId: 2f84dd68-f5a3-4a2a-ae19-bb979cc1d73d
    serviceRequestId: e485e69f-008c-1000-04b3-5b51b2dabb83

    Like

    1. Hi Lucas,

      Add “ListItem” after “DASHBOARD” with no spaces.

      Let me know how you make and thanks for reading!

      NY

      Like

      1. Hi Norm Young,
        I performed the test but it still has an error

        {‘__metadata’:{‘type’:’SP.Data.DASHBOARDListItem’},’FolderLocation’:{‘Description’:’@{variables(‘varFolderName’)}’,’Url’:’@{outputs(‘Criar_nova_pasta’)?[‘body/{Link}’]}’}

        Here is the photo of my stream:
        https://bragasolucoes01-my.sharepoint.com/:i:/g/personal/lucas_palma_bragasolucoes_com_br/ESlQNjoM2S5GqcRD2ss0UI0BU2cFgqeOj4wRmYRY0i4a4Q?e=BrKYlc

        Like

      2. Hi Lucas,

        The syntax looks correct. Manually put in a known ID number to further debug.

        Thanks.

        NY

        Like

  16. Greetings, Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job, Keep it up. You can check out this article, might be of help 🙂

    Like

  17. Hi Norm, it says following is not a valid json:
    {
    “Content-Type”: “application/json;odata=verbose”,
    “X-HTTP-Method”: “MERGE”,
    “IF-MATCH”: “*”
    }
    anything wrong?

    thanks,
    JIm

    Like

  18. Hi Norm,

    I have issue with error details.

    The property ‘url’ does not exist on type ‘SP.FieldUrlValue’. Make sure to only use property names that are defined by the type.
    clientRequestId: 77ffc016-0a13-473b-9314-d35664102ef5
    serviceRequestId: a7da2ba0-e013-1000-15c2-bb3d3f9d066c

    this error statement maybe related with column “Folder Location” in my SP list.
    So I still confusing about this. can you advice me ?

    Like

    1. Hi Dieunk,

      The column name is specified in the “Send HTTP request to SharePoint” action. In my example the column name is ‘FolderLocation’ and is a URL column type.

      Based on the error message you provide it looks like the column is called “UrlValue”. Confirm the internal column by going into List settings and click the column name. The internal name is shown at the end of the url in the address of your browser.

      Let me know how you make out.

      Thanks for reading!

      NY

      Like

      1. Hi Norm,

        this is my internal name:
        https://abcd.sharepoint.com/sites/TeamDev/_layouts/15/FldEdit.aspx?List=%7B4BF325FB%2D4345%2D4F4E%2D8F56%2DB99775651130%7D&Field=FolderLink

        “Send HTTP request to SharePoint” action

        {
        ‘__metadata’:
        {
        ‘type’:’SP.Data.TFM_x0020_CustomerListItem’
        },
        ‘FolderLink’:
        {
        ‘Description’:’@{variables(‘VarFolderName’)}’,
        ‘url’:’@{outputs(‘Create_new_folder’)?[‘body/{Link}’]}’
        }
        }

        so I test again, but still show the same error details 😦
        please, let me know, if I still doing wrong

        Like

  19. Hi Norm,

    Extremely useful information! Thanks so much for sharing.

    I was wondering if you could help me out with 2 things:
    1) The folder is now auto-populating in my Document Library but I want to get the hyperlink to this folder to auto-populate in the Sharepoint List Column without having to copy it in each time. Any ideas on how to get this to work?
    2) I am also trying to get the Name of the Document Library Folder to match the ID number of the List Item – so they are clearly and visibly linked for everyone to see and understand.

    Any help you can provide would be greatly appreciated.

    Many Thanks,
    Catherine

    Like

    1. Hi Catherine,

      The Flow pattern should take care of auto-populating the list item with the URL. Sorry if I am not understanding the question.

      In the Flow pattern I use a variable that concatenate the ID and Title columns, so it is unique and readable by users. If you want to specify the list ID value, simply ignore the variable and use the ID value form the Create item dynamic output.

      I hope that helps and thanks for reading!

      NY

      Like

      1. Hi Norm,

        Thanks for the feedback. I got the ID nomenclature sorted, but I am still getting an error with Send HTTP request to sharepoint.
        I have been through all the feedback above but I cannot seem to make it work.

        List name: Technical Master List
        Column initialize variable: varFolderLocation
        Value: ID column from the Master List

        Uri
        _api/web/lists/GetByTitle(‘TechnicalMasterList‘)/items(@{variables(‘varFolderLocation’)})

        Body
        {‘_metadata’: {‘type’:’SP.Data.Technical_Master_ListListItem’},’FolderLocation‘: {‘Description’: ‘@{variables(‘varFolderLocation’)}‘, ‘Url’: ‘@{outputs(‘Create_new_folder’)?[‘body/ID’]}‘}
        }

        Error Details
        The expression “web/lists/GetByTitle(‘TechnicalMasterList‘)/items(11)” is not valid.
        clientRequestId: dd60cf06-1a8d-4ce3-9c4d-33833fcd2119
        serviceRequestId: 679c33a0-f071-3000-dd6b-9ce9ff806a59.

        Any help would be greatly appreciated.

        Thanks,
        Catherine

        Liked by 1 person

      2. Hi Catherine,

        Two things. The List name is spelled differently in the code you provided. Is the display name TechnicalMasterList? Is the internal name Technical_Master_List?

        Add another underscore to _metadata – __metadata.

        Let me know how you make out.

        Thanks for reading!

        NY

        Like

  20. I am having an issue similar to the ones above although I still can’t figure it out.

    I get this Error Details

    The expression “web/lists/GetByTitle(‘Drawing Register‘)/items(10)” is not valid.
    clientRequestId: 48be836d-4d3c-41ea-9b7b-803219864e5a
    serviceRequestId: 203845a0-c0be-1000-4eab-506490ecd60c

    I have the rookie space in my list name.

    But even when I correct either with %20 or @20 or _ it still has this issue.
    Not sure if that is related

    Here is the OUTPUTS Body

    {
    “status”: 400,
    “message”: “The expression \”web/lists/GetByTitle(‘Drawing Register‘)/items(10)\” is not valid.\r\nclientRequestId: 48be836d-4d3c-41ea-9b7b-803219864e5a\r\nserviceRequestId: 203845a0-c0be-1000-4eab-506490ecd60c”,
    “source”: “https://site.com/teams/ProjectTest/_api/web/lists/GetByTitle(%E2%80%98Drawing%20Register%E2%80%98)/items(10)”,
    “errors”: [
    “-1”,
    “Microsoft.SharePoint.Client.InvalidClientQueryException”
    ]
    }

    Thanks for any help.

    Like

    1. Hi Alex,

      Assuming there are no syntax errors, especially with “__metadata” and single quotes, check the internal list name by adding this to the URL:

      /_api/Web/Lists/GetByTitle(List Name here’)?$select=ListItemEntityTypeFullName

      Thanks for reading!

      NY

      Like

  21. Dear Norm, it’s just such a fantastic way of working and explanation, but can’t get my head around it. I read the same things here above, but even with the help I can’t figure it out. Maybe you can have a look.

    I also have this message:
    The expression “web/lists(‘f9bb7ab3-6097-4dcc-879d-8e8fcbf11d53‘)/items(24)” is not valid.

    This would be the complete Uri I use. When I use it directly I get an XML message. Also the internal listname check doesnt work.

    https://URL.sharepoint.com/sites/SPSITE/_api/web/lists(%E2%80%98f9bb7ab3-6097-4dcc-879d-8e8fcbf11d53%E2%80%98)/items(24)

    Do you have any advice for me?

    What I use in HTTP Request:
    Uri:
    _api/web/lists(‘f9bb7ab3-6097-4dcc-879d-8e8fcbf11d53‘)/items(ID)

    Headers:
    {
    “Content-Type”: “application/json;odata=verbose”,
    “X-HTTP-Method”: “MERGE”,
    “IF-MATCH”: “*”
    }

    Body:
    {‘__metadata’: {‘type’:’SP.Data.EmployeesListItem’},’EmployeeFolder‘: {‘Description’: ‘varFolderName’, ‘Url’: ‘LinktoItem‘}
    }

    Please let me know if I missed something here.
    Thanks! And kind regards,
    Art from The Haven Night Shelter Welfare Organisation.

    Like

    1. Hi Gart,

      Thanks for the feedback. Are you using the GetByTitle function with the list display name in the Uri? Also, are you using the dynamic ID value from the SharePoint get items action?

      Thanks for reading!

      NY

      Liked by 1 person

      1. Thanks for the reply!

        Hi, I get the message: The expression “web/lists/GetByTitle(‘Employees‘)/items(42)” is not valid.
        using: _api/web/lists/GetByTitle(‘Employees‘)/items(ID) (from Create New Folder)

        but also testing the internal link doesn’t work. Would be nice if I could share screen shots or so. But not possible, right)?

        Like

  22. Hi Norm,

    Thank you for this very interesting article.

    I am having an issue with the headers. I am copying and pasting directly from your text in this blog, but it is saying that the JSON is not valid.

    Any ideas?

    Thanks

    Like

    1. Hi Declan,

      Make sure you are using straight double quotes “. WordPress changes the format.

      Let me know how you make out and thanks for reading!

      NY

      Like

  23. Norm,
    I add my thanks and applause to the many others who, like me, found just what they needed in your post.

    After I worked through a list title issue with the advice you provided I was still stuck on writing the link.
    My issue was, as you mentioned multiple times, the quotation marks.
    I typically use Notepad for debugging code. Notepad was not helpful in this instance.

    I used Microsoft Word. The difference between the quotation mark characters is clear. Search/Replace did not work to correct – I had to copy and paste the straight/vertical quotation marks to replace the slightly rounded/slanted ones.

    I hope someone else may find this useful.

    Like

    1. Hi Ronnie,

      Sorry for the delayed response. The summer is hear and I am doing my best to enjoy it away from the computer as much as I can.

      WordPress changing quotes have caused to many issues and I will be changing the theme shortly to avoid these issues.

      I appreciate your kind words and will be sharing your debugging approach using Word.

      Thanks again!

      NY

      Like

  24. Hi Norm!! I am receiving this error:

    401 UNAUTHORIZED
    clientRequestId: 523444e2-be84-4beb-b50a-2f482c118922
    serviceRequestId: 90b455a0-0037-1000-7267-f05046585ffc

    List Name: Project

    Uri : api/web/lists/GetByTitle(‘Project‘)/items(@{outputs(‘Create_new_folder’)?[‘body/ID’]})

    Headers:
    {
    “Content-Type”: “application/json;odata=verbose”,
    “X-HTTP-Method”: “MERGE”,
    “IF-MATCH”: “*”
    }

    Body:
    {‘__metadata’: {‘type’:’SP.Data.ProjectListItem’},’Folder‘:
    {‘Description’: ‘@{variables(‘varFolderName’)}’,
    ‘Url’: ‘@{outputs(‘Create_new_folder’)?[‘body/{Link}’]}’}
    }

    Can you please help me figure out where i am going wrong.

    Thanks in advance

    Like

      1. I change the quotes to the straight one, still it’s showing the same error.

        Body:
        {‘__metadata’: {‘type’:’SP.Data.Project_x0020_Opening_x0020_FormListItem’},’Folder’: {‘Description’: ‘@{variables(‘varFolderName’)}’,
        ‘Url’: ‘@{outputs(‘Create_new_folder’)?[‘body/{Link}’]}’}
        }

        Uri:
        api/web/lists/GetByTitle(‘Project_x0020_Opening_x0020_Form’)/items(@{triggerOutputs()?[‘body/ID’]})

        Like

  25. Hi Norm, thank you so much for providing so much great detail herein. I, too, have been pouring over this and another function for days. I am officially stuck on “Item does not exist” in this write-back to list flow for the new folder path. I am trying to implement this in a few lists and have felt me way through many of the prior issues mentioned in these conversations but I am not skilled or knowledgeable enough to see the error that exists here.

    List name is Test List, filed to write back to is Doc Folder

    Uri:
    _api/web/lists/GetByTitle(‘Test List’)/items(@{outputs(‘Create_new_folder’)?[‘body/ID’]})

    Hearders:
    {
    “Accept”: “application/json;odata=verbose”,
    “IF-MATCH”: “*”,
    “X-HTTP-Method”: “MERGE”,
    “Content-Type”: “application/json;odata=verbose”
    }

    Body:
    {‘__metadata’: {‘type’:’SP.Data.Test ListListItem’},’DocFolder’: {‘Description’: ‘@{variables(‘varFolderName’)}’, ‘Url’: ‘@{outputs(‘Create_new_folder’)?[‘body/{Link}’]}’}
    }

    Once I can clear this issue I then want to copy a templates folder (that is also in the same doc library) into the new variable folder but I am also stuck there with “Failed to verify the existence of destination location at ‘https://xxxxxxxxx.sharepoint.com/sites/Aalden Workspace/DocFolder’ due to error ‘The system cannot find the file specified. (Exception from HRESULT: 0x80070002)’.
    clientRequestId: 9dfddb13-b30f-41f3-946d-f656a89b7ed6
    serviceRequestId: 9dfddb13-b30f-41f3-946d-f656a89b7ed6

    I am hoping that you might be able to quickly see the issues. I can send the flow visuals/details on any of this. I appreciate any support.

    Amy

    Like

    1. Hi Amy,

      It looks like you are using the wrong ID in the URI. In the code you supplied ID is coming from the Create Folder action and should be coming from the When an item is created trigger.

      Make that change and let me know how you make out.

      Thanks for reading!

      NY

      Like

  26. Great post Norm, thanks for this, I used a year ago and it’s still working perfect today!

    Question for you on a ‘Version 2.0’- I haven’t found a solution yet, and not sure if possible: We have 6 peer reviews that are sent throughout the year to our faculty via WordPress and submitted in separate Lists in SharePoint.

    Review 1 is the standard and is sent with all. This is the review I used to create the folder and link back to in Lists. For Reviews 2- 6 these are randomly selected depending on faculty level and not all are issued, is it possible to take the folder link created from the Review 1 List, and if the ‘ReviewNum’ in the other Lists matches, apply this link to the FolderLocation for those columns as well? Send HTTP Request to SharePoint is getting stuck on the ID match in Review 1 as the other Lists 2-6 have various ID’s. Thanks!

    Like

    1. Hi Kenn,

      I would store the ID into a variable after creating the first folder and then pass in that variable value in as required.

      Hope this helps and thanks for reading!

      NY

      Like

  27. Hi Norm, Great Article, thank you.

    I have an issue in that folders are only created if I create a new list item. If a Colleague creates a new item, a folder is not generated.

    I guess this has something to do with the flow context. I am not sure how to make the flow operate no matter who creates a new item.

    Any thoughts that would help me solve this?

    Like

  28. Apologies Norm, I just made a post about flow context. But Have since discovered that the issue was illegal characters.

    I notice that if I put a ‘/’ in the title, I get a sub folder created.
    My Colleague who created the item that did not get a folder had also put a ‘?’ in the title.

    Is there a way to deal with this in a flow?

    Like

Leave a comment