pnpcore
pnpcore copied to clipboard
Properties not yet Loaded for a Files modifiedBy
Category
- [x] Bug
Describe the bug
When trying to query properties (Id, UserPrincipalName, AadObjectId) of the ModifiedBy of a File, it fails with the following error message:
Property [X] was not yet loaded
- X being the name of a property
It is intermittent too. Sometimes it has the property value and other times it doesn't.
Steps to reproduce
Below is the code I'm using:
var item = await list.Items.GetByIdAsync(itemId, i => i.Id,
i => i.File,
i => i.Versions,
i => i.FileSystemObjectType);
var file = await item.File.GetAsync(
f => f.TimeLastModified,
f => f.Name,
f => f.CheckOutType,
f => f.ModifiedBy.QueryProperties(u => u.Id, u => u.AadObjectId, u => u.Mail, u => u.UserPrincipalName));
var modifiedById = file.ModifiedBy.Id // <-- Fails on this line
Expected behavior
After getting the file, the properties on ModifiedBy should be available
Environment details (development & target environment)
- SDK version: 1.12.0
- SDK used in: Azure hosted Web Job
- Framework: .NET v8