Requesting SPFile.Exists with other properties gives a FileNotFoundException #10258
Open
1 of 9 tasks
Labels
area:csom/rest/api
Category: SharePoint Client Side Object Model SDK / REST API
type:bug-suspected
Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Uh oh!
There was an error while loading. Please reload this page.
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
.NET 6.0
Microsoft.SharePointOnline.CSOM 16.1.26017.12000
Describe the bug / error
This maybe by design, but it caused us a headache to figure this one out.
When we do a CSOM query to know if a file exists, then the the SPFile.Exists property is returned without exceptions. The SPFile.Exists contains a boolean with true or false.
When the Exists CSOM query is executed with more information such as list column names, then the SPFile.Exists contains also true or false without exceptions.
When more file fields are queried at once (to save some extra calls in order and avoid throttling), then an ServerException (FileNotFoundException) is thrown.
Steps to reproduce
Execute the following code fragment:
The last ExecuteQuery() call throws a ServerException.
This behavior is unexpected.
Expected behavior
We expected one way or the other, thus either:
The text was updated successfully, but these errors were encountered: