Microsoft Flow – New!! – When a file or item is deleted triggers

Microsoft Flow Connector

Today I had a look at the SharePoint connector in Microsoft Flow and there are two new trigger and one new action.

When a file is deleted

In this post I’m going to have a look at the “When a file is deleted” trigger.

Then when you look at the information available after this action within the dynamic content, it is easy to find out which file was deleted and who deleted the file. It is even possible to find out when it was deleted.

Although it isn’t possible to undelete the file or to get to the content of the file at least you can now trigger  process that you would like to start on deletion of a document.

Both of these  Dynamic content options give you the data you would expect. Also note that the ID of the document is given! This ID can also be retrieved then you use a variable of the type Integer

Looking at the name of the dynamic content “List of Deleted items”, I would have expected that deleting multiple documents would only trigger one flow. This however is not the case. When you delete multiple documents you only get one document listed in each flow and multiple flows will be started.

Deleted By username displays the user’s display name rather than their user login. I’m not sure if this could cause problems, but it is at least something to be aware of.

Then I tried deleting folders and this trigger even handles the deletion of folders within your library. in short this looks like a nice improvement to the Flow offerings.

But this is not all! There is also a trigger for the deletion of items:

Other than handling items rather than handling files in libraries there is no real difference.

 

 

 

 

 

 

 

 

 

 

 

 

Advertisements

16 thoughts on “Microsoft Flow – New!! – When a file or item is deleted triggers

  1. Hello, great article!

    Upon delete of an item in the SharePoint calendar I want this item also deleted from the users calendar via Microsoft Flow. I followed this guide to create a Flow to have the item added or modified, which works great:

    hxxps://powerusers.microsoft.com/t5/Building-Flows/SharePoint-Calendar-and-Events/m-p/121418#M11799

    But now I want to also create a Flow to delete an item if it’s deleted from SharePoint.

    I found the “When an item is deleted” action but I’m stuck, the Get Item action can’t be used because the item is already deleted.

    Please assist, it will be greatly appreciated!

    Like

    1. “But now I want to also create a Flow to delete an item if it’s deleted from SharePoint.”

      And here I mean:

      But now I want to also create a Flow to delete a calendar item from the users calendar if it’s deleted from a SharePoint Calendar.

      Like

    2. Hi Andries,

      All the deleted item trigger gives to you is:

      {
      "ID": 10,
      "Name": "test",
      "FileNameWithExtension": "test",
      "DeletedByUserName": "Pieter Veenstra",
      "TimeDeleted": "2018-06-04T12:34:31Z",
      "IsFolder": false
      }

      And indeed it is not possible to get to the data of the deleted item. Therefore the only way you could identify the calendar item would be by storing the ID and Name in the calendar item somewhere.

      You could probably use the above information tho get to your deleted item in the recycle bin. I will create a post for this shortly.

      Like

      1. Thank you for your quick reply! I do have a custom column in SharePoint named “outlook event id”, Outlook fill this field. ( see hxxps://powerusers.microsoft.com/t5/Building-Flows/SharePoint-Calendar-and-Events/m-p/121418#M11799) However I don’t seem to be able to use this field when using the “When an item is deleted” action?

        Like

      2. Hi, very nice write up. Have you found a way to access the recycle bin with Flow? I’d like to get some more properties from the deleted file.

        Like

      3. You can get to the recycle bin through the rest API ( /_api/web/RecycleBin ), however that isn’t going to give you any of the metadata that originally belonged to the document.

        Like

  2. Thanks for you analysis of the delete trigger. I wanted to use that trigger to notificate the creator of an item, that its item was deleted, in case someone else did it or he/she per accident.
    Unfortunately “get item” does not work anymore, once the item is deleted (surprise!) and I did not find a way to inform the person who created the item.

    Have you found out something?

    Like

  3. Are there any special requirements needed to get this trigger to return values? I’ve built a flow and pointed it at a SharePoint calendar with just a basic email out. The trigger does start when I delete a calendar item, but the flow sends empty values for all fields except for ID (Deleted By, Filename with Extension, and Name are all EMPTY).

    I tried turning on versioning for the calendar, but that did not help.

    Like

  4. I have used when file is deleted but in body out put Name, FileNameWithExtension
    and DeletedByUserName are showing blank
    {
    “ID”: 44394,
    “Name”: “”,
    “FileNameWithExtension”: “”,
    “DeletedByUserName”: “”,
    “TimeDeleted”: “2019-07-17T08:49:03Z”,
    “IsFolder”: false
    }

    Like

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.