Replies: 1 comment 2 replies
-
@ChrTall : if the user does not exist anymore you cannot query it like that. Did you try loading the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I load File Properties of a folder I want to display all Items and Subfolders with their following Properties: Name, ModifiedBy, Size etc.
The problem I am facing is that we migrated Exisitng Data from a OnPremise Sharepoint to Sharepoint 365 and not every User that Modified a File is in AAD. When I view the Folder in Sharepoint Web UI there is a property with the name, but you can not click and expand the User like with Users that exist in AAD.
I am using the following way to get the Files from the folder:
var files = await currentFolder.Files .QueryProperties(file => file.Name, file => file.TimeLastModified, file => file.LinkingUrl, files => files.ServerRelativeUrl, file => file.Length) .QueryProperties(file => file.ModifiedBy) .ToListAsync();
And then I iterate over them:
await file.ModifiedBy.EnsurePropertiesAsync(modBy => modBy.Title);
This throws a exception because the User is not in Azure Active Directory.
I don´t know if this is only a problem for old data that is migrated, because from time to time Users may get removed from AAD because they leave the company. Then you would also get this problem.
Is there another way to get the name of the user that modified the file? It is metadata like for any other ListItem isn´t it?
Beta Was this translation helpful? Give feedback.
All reactions