An API that connects multiple Microsoft services, enabling data access and automation across platforms
You can try checking for the userType field of the user resource as for work or school accounts, this will either be member or guest while the personal accounts dont have this field. I am not 100% sure of this answer. You can also consider filling a feature request on Microsoft 365 Developer Platform