Delete folder older than x days in sharepoint

I am trying to get folder creation date in sharepoint library so I can delete folder older than x days, I am using the sharepoint activity but I could’t found there any method that can get the folder creation date.
How can delete folder older than x days in the sharepoint library.

Hi @akash.sathe

Welcome to our UiPath Forum! :slight_smile:

Which activity package is it exactly?

I am using UipathTeam.SharePoint.Activities this manage package In this library package there are some Library Activity, so I am using one of them call Get Children activity so that I am able to get the SharePoint folder name. but can get folder creation datetime.

In order to get properties like the Created Date or Last Modified Date you can use the Get List Items activity on your library.
A caml query like the one below will return the properties of all the folders in a SP Library:



<FieldRef Name= 'ContentTypeId' />

<Value Type= 'ContentTypeId' >0x0120</Value>



You could also use a CAML query which returns all items at a certain path (including your folder), like the one below:

<Query><Where><Eq><FieldRef Name='FileDirRef' /><Value Type='Text'>/sites/jerrydev/doc2/Fred Beans Group (PA)</Value></Eq></Where></Query></View>

The documentation on connect should help you understand how to use these queries. You could also try SmartCaml (free app on the Microsoft Store) to generate queries for you automatically

1 Like