Need help for initialize and create database with code

Hi, and sorry for my bad english…
I plan to make one new desktop application only in mac os, with sqlite database.
The database IS with Secret key encripted with one table name : Members and one field named Name.
The database I have put in OneDrive and his name is, Territos.db.

Please can you me help to make only in the open event from the app the next :

1-Look If onedrive is instaled and if not, give a message to the user to install onedrive
2-If one drive is installed, verifi If the data base TerritosDB.db is into onedrive.
3-Last step, If database are not created then create new TerritosDB.db SQLite database and then open it with him Secret key encripted.

I apreciate any help for create this with code, thanks very much for your interest…

1-3: I know nothing about OneDrive. So no comment here.

Try first in your local HD, then change to OpenDrive.

If the Data base does not exists, its FolderItem is Nil. You only have to check your file reference against Nil:

If TerritosDB_FI = Nil Then
// Put here the code to create the TerritosDB.db file
End If

Not true.
The folderitem can be non nil and valid, even when the file does not exist.
Thats how you create a new file… make a folderitem that points to a non-existing file, and then save to it.

If TerritosDB_FI = Nil Then msgbox "badly constructed folderitem" else If not TerritosDB_FI.exists Then // Put here the code to create the TerritosDB.db file end if End If

OneDrive is part of Window from 8.1 onwards.
But it may not be active or the user may not be logged in (I have it turned off myself), so even detecting that it exists is not enough to be sure.

Maybe the API is what you need, although I havent seen any worked examples done in Xojo yet/
(Christian … this sounds right up your street… :> )

https://docs.microsoft.com/en-us/onedrive/developer/rest-api/

Perhaps you should consider just creating the file locally, and allowing OneDrive (if it exists) to replicate the file in the Cloud?

Thanks very much for your help Emile and Jeff, I appreciate your help and I want give a try.
Have a nice day.

Jeff: I have a WIndows 8.1, then Windows 10 since… 3 and half years, and I learned something more today !

Thank you !