Hi @ArmDezii ,
Our forum mainly focus on C# code. I can provide you with a C# solution. As a workaround, you can try to use some tools to convert C# code to vba.
ClientContext cxt = new ClientContext("http://xxx/sites/test");
List list = cxt.Web.Lists.GetByTitle("Documents");
cxt.Load(list);
cxt.Load(list.RootFolder);
cxt.Load(list.RootFolder.Folders);
cxt.Load(list.RootFolder.Files);
cxt.ExecuteQuery();
FolderCollection fcol = list.RootFolder.Folders;
List<string> lstFile = new List<string>();
foreach(Folder f in fcol)
{
if (f.Name.EndsWith(".jpg"))
{
cxt.Load(f.Files);
cxt.ExecuteQuery();
FileCollection fileCol = f.Files;
foreach (File file in fileCol)
{
lstFile.Add(file.Name);
}
}
}
Since your issue is about sharepoint development with vba. You can also get some more professional answer in techcommunity
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.