check the filemode: does it include fmCreate? E.g. fmCreate or OpenWrite
This will either create or overwrite a file. Assuming underlying TFileStream:
https://www.freepascal.org/docs-html/rtl/classes/tfilestream.create.html
The TSaveDialog does not set any TFileStream options itself: it merely checks if the ofXXX options are satisfied, NOT the TFileStream fmXXX options.
That's the thing: No Filestream is even prepared, nevermind created.
The Message comes after clicking on "Save" in the SaveDialog, meaning: During the "Execute"-Method, before it returns to my own code
EDIT: Progress!
ON a hunch, in the SaveDialog i moved/choose "c:\Temp" instead of my OneDrive and voila: No Error-Message. Execute returns True
But instead, SaveDialog.FileName is now empty....
What now??
There is something seriously wrong
EDIT2: Right. On a Vanilla-Project (Form, Button, SaveDialog)
it's definitely the OneDrive, specifically the "My Documents"-Folder.
If i choose any Folder, that's not a SubFolder of my OneDrive, SaveDialog.FileName returns the FileName, otherwise i get the above ErrorMessage (File not found)
Feels like access-rights or something.....
EDIT3
Further testing:
Any Folder below "c:Users\xxxx.xxx\OneDrive - MyCompany" returns the Error-Message "File Not found"
Folder "c:Users\xxxx.xxx\OneDrive - MyCompany" and any Folder above/outside returns True for Execute and returns the FileName.
Hmm....all SubFolders of "c:Users\xxxx.xxx\OneDrive - MyCompany" are synced to the Sharepoint.
Sounds like Trouble with Pathnames
I remember executing an Excel-Macro inside my OneDrive-Documents-Folder, and it returned that "sharepoint"-Notation for ThisWorkbook.Path