Replies: 1 comment 3 replies
-
@ivonool : below works for me: IFile testDocumentLoadedById = await context.Web.GetFileByIdAsync(Guid.Parse("{0c89259b-af52-4c78-aa9d-b6385ac563ca}"), p => p.ServerRelativeUrl);
var folderPath = Path.GetDirectoryName(testDocumentLoadedById.ServerRelativeUrl).Replace("\\", "/");
IFolder folder = await context.Web.GetFolderByServerRelativeUrlAsync(folderPath, p=>p.Files);
foreach (var file in folder.Files.AsRequested())
{
// Use the file
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I'm not sure if it is a bug or I'm doing something wrong anyway I'm trying to load Folder for a File. I have a file UniqueId and need to load all the files in that folder. Current code:
var mainFile = await context.Web.GetFileByIdAsync(fileGuid), f => f.ListId, f => f.ListItemAllFields);
var mainFileItem = await mainFile.ListItemAllFields.GetAsync(p => p.Folder, p => p.UniqueId);
var folder = mainFile.ListItemAllFields.Folder;
await folder.LoadAsync(f => f.Files);
Whenever last line is executed, I get the error:
PnP.Core.ClientException: Unresolved tokens found in API call https://xyz.sharepoint.com/sites/xyz/_api/Web/Lists(guid'{List.Id}')/Items(63)/Folder?$select=UniqueId%2cFiles&$expand=Files
So for some reason List Guid seems to be missing in the URL. Any ideas? Using version 1.9.0
Beta Was this translation helpful? Give feedback.
All reactions