SharePoint activities, deleting files

Hey,

I would like to delete all files beginning with “xxx” from a sharepoint folder. I have no idea on how to do it using sharepoint activities. There is a delete file activity but how can I filter the files ? (There’s no “for each” in sharepoint activities).

If anyone have a good knowledge with sharepoint activities, please help.

Thanks

UiPath has For Each activity that can be used with any argument type…

Thanks for your answer! I don’t think there’s an argument type for SharePoint URL…

Hi again, sometimes the libraries cant do what we need so i did in as invoke code activity:

Dim context As ClientContext = New ClientContext(“https://DOMAIN.sharepoint.com/sites/intranet”)
Dim varsecurePassword As SecureString = New SecureString()
Dim openPwd As String = “YourPassword”
For Each c As Char In openPwd
varsecurePassword.AppendChar(c)
Next
varsecurePassword.MakeReadOnly()
context.Credentials = New SharePointOnlineCredentials(“User@Domain.com”, varsecurePassword)

Dim MyLibray As List = context.Web.GetList(“https://DOMAIN.sharepoint.com/sites/intranet/documents”)
context.Load(MyLibray)

Dim folder As Folder = MyLibray.RootFolder
context.Load(folder)

Dim files As FileCollection = folder.Files
context.Load(files)
context.ExecuteQuery()

For Index As Integer =0 To files.Count - 1
Dim file As Microsoft.SharePoint.Client.File = files(Index)
Dim item As ListItem = file.ListItemAllFields
context.Load(item)
item.DeleteObject()
context.ExecuteQuery()
Next Index

context.Dispose()

Thank you so much @bcorrea ! I’m having the error “too few type arguments” at line 10, and also some “Type is not defined” errors. How can I fix this?

You didnt uninstall that Sharepoint package right?

No, it’s still here. I can create variables with those Types, but can’t use them in the code invoked. Weird…

strange, i didnt do anything but installing that package to get the Imports for Microsoft.SharePoint.Client namespace…