KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Office365 Service Connection – Error "/me request is only valid"
PRODUCT: 4D | VERSION: 20 R | PLATFORM: Mac & Win
Published On: January 13, 2026
When using Microsoft Graph API with 4D NetKit and an Office365 Service (application) connection, calling a mail command such as:
$office.mail.getFolderList()

returns:
400 Bad Request "/me request is only valid with delegated authentication flow."

When Office365.mail.userId is not defined, the Office365 provider automatically falls back to the /me endpoint, which causes the request to fail because this endpoint is reserved for delegated (SignedIn) authentication.

The developer must explicitly specify the mailbox user before calling any mail command.

$office:=cs.NetKit.Office365.new($oauth2)
$office.mail.userId:="user@domain.com" // userPrincipalName
$office.mail.getFolderList()