Skip to main content

I guess I just realized something. I have a document library in SharePoint Online that is storing items (usually PDF documents) put there by an NAC workflow, using the Store a file function. There are now over 2,700 items in this document library and I need to set up a means, presumably through a Scheduled start workflow, of deleting some of them on a regular basis (say, after they’ve been there for 90 days).

But it seems that there is no NAC function for deleting files in a document library. Is this right? NAC will store the files but it can’t remove them?

I tried the Delete items function but it's meant for a SharePoint list. I can select the Documents folder as the “list” from which I need to delete items, but the items I need to delete are in a subfolder within the Documents folder. I don’t see a way to drill down to that subfolder and delete only certain items within it.

Is this not possible to do in NAC?

For now, I would recommend creating an “Archived” library that is restricted from users. Have a flow in Power Automate delete all files in the archived library on the back end for that library on a scheduled or something. 

I have created an idea for this need: When an item or file is deleted in SPO | Nintex Ideas
 

I’d go vote and get as many folks to vote on it as possible so Nintex can consider adding this to their roadmap! This is a feature we desperately need on our end as well.

Power Automate offers both actions so not 100% sure why Nintex doesn’t: 

 


Sorry, misread your post. 

So that idea won’t benefit you but we still need those two actions. 

Let me investigate further. I don’t think you can delete files in NAC.


Thanks, @brandiwoodson

Yes, I added a comment to your Nintex idea to clarify what I meant. I was already thinking about creating a flow in Power Automate and I’m going to look into that. I already have a couple of flows that move files, so I’ll see if I can delete the ones in question here.


The delete items action does not show libraries in the drop down for selection so you will not be able to delete files in a library.

So, my recommendation remains the same, use power automate to delete files that are X # of days old in the library that your process is supported by. 

If you need to avoid overlap or conflict of actions between Nintex and Power Automate, I would just “move” your files using NAC to an “Archived” library and have your power automate flow delete files from the “Archived” library instead. I haven’t really built many solutions that are “hybrid” - meaning using Nintex and Power Automate for the overall solution. When I have it was on a smaller scale of actions that didn’t overlap one another. That being said, I could be overthinking it all together and the “Archived” library may not even be needed. :)


I am editing my idea to include all of that as well. 

Just checked, power automate has what you need. 
 

 


Thanks again. My library is already kind of an “archive.” NAC places the document there and then retrieves it to create a new file with a different name and attach it to an item in an SPO list. (No need to get into the weeds as to why I need my workflow to do that lol.) But yes, I’ll build a Power Automate flow to delete the files based on the date added.


Hello,

I believe in certain context, a SharePoint list will refer to both a “list” or a “library”.

For example, DocLibTest1 in this screenshot is a library, but it shows up in the List name drop-down:

To delete items in the library that have been there for 90 days:

  1. create a variable and set it to the current date
  2.  

  3. add -90 days to it, which would give you the date that would make a file older than 90 days
  4.  

  5. then in the delete use the ‘Items and folders at all levels’ with perhaps the ‘Created’ date field is before the variable
  6. **I used a TestDate column here because it allow me to set the date for testing, but you would use either the Created (datetime) or Modified (datetime) field or any other conditions as necessary

  7. In my testing, it does seem to delete items that are older than 90 days from now

  8.  


Thank you, @TinTex. But in your example, won’t it delete ALL items older than 90 days that are in the document library? I need it to delete only items in a specific subfolder within the document library.


That is correct this example would delete all items and folders that are older than 90 days.

 

I don’t believe there is an option in the Delete Items action to specify a folder.  But if it did, this would mean that in your scheduled workflow design you would need to identify and pass it the folder name from somewhere else also.

 

Do you have any other metadata column that you can use in conjunction the older than 90 days] condition to uniquely identify those items to be deleted?


I don’t believe there is an option in the Delete Items action to specify a folder.  But if it did, this would mean that in your scheduled workflow design you would need to identify and pass it the folder name from somewhere also.

Right, there is no such option. This is why I believe a Delete a file function should be added to the designer canvas (this is part of Brandi Woodson’s newly posted Idea, noted above). 

Do you have any other metadata column that you can use in conjunction the nolder than 90 days] condition to uniquely those items to be deleted?

No, I don’t have any other metadata. I considered that, but I think it will just be easier for me to create a flow in Power Automate - in fact, I’ve already done so.

Thanks for your responses.


@TinTex  Interesting, we have tons of libraries on the site I’m attempting to use to test this, and I don’t see a single library in the drop down. 


Here is what I see for this site, which begins with my lists on the site (not libraries):
 

 


Hm… Interesting.

Could you try scrolling down.  It should show both list and library.  Seeing that the last item in drop-down list is ‘Designer Test_...’ but the first document library is ‘Dev_Document...’; it is maybe lower in the drop-down list.


Hm… Interesting.

Could you try scrolling down.  It should show both list and library.  Seeing that the last item in drop-down list is ‘Designer Test_...’ but the first document library is ‘Dev_Document...’; it maybe lower in the drop-down list.

OMG! You are right. Rookie mistake! 


Hi @DavidAD

 

it is possible but not with the OOB actions, I know there is an xtension floating around that lets you query folders contents and files etc, I’ll see if I can find it for you. 
 

Jake 


Reply