Skip to content

4d/4D-NetKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

700 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4D NetKit

Version: 21 R4

4D NetKit is a built-in 4D component that lets you connect your applications to third-party web services and consume their REST APIs directly from 4D code. It handles the OAuth 2.0 authentication flows for you and provides high-level, object-oriented clients for the most common Microsoft Graph and Google Workspace services.

Overview

With 4D NetKit you can:

  • Authenticate to Microsoft and Google identity platforms using OAuth 2.0, in both signedIn (Authorization Code, interactive) and service (Client Credentials / JWT Bearer, unattended) modes — including PKCE, refresh tokens, and certificate-based client assertions.
  • Send and manage emails: send, reply, append, move, copy, update, and delete messages; manage folders and labels; read messages in MIME, JMAP (4D mail object), or native Microsoft format.
  • Manage calendars and events: list calendars, and create, read, update, and delete events, including attachments and attendees.
  • Read user profiles: query individual users or paginated user directories.
  • Organize items: read Outlook master categories (Microsoft).
  • Receive change notifications: monitor mailbox and calendar changes through push/pull notifiers.

Warning: Shared objects are not supported by the 4D NetKit API.

Getting started

Authentication is always the first step. You create an OAuth2Provider object that holds your credentials and retrieves access tokens, then pass it to a service client (Office365 or Google).

// 1. Create an OAuth2 provider
var $oauth2 : cs.NetKit.OAuth2Provider
$oauth2:=New OAuth2 provider({\
  name: "Microsoft"; \
  permission: "signedIn"; \
  clientId: "your-client-id"; \
  redirectURI: "http://127.0.0.1:50993/authorize/"; \
  scope: "https://graph.microsoft.com/.default"})

// 2. Create a service client and use it
var $office365 : cs.NetKit.Office365
$office365:=New Office365 provider($oauth2)

$office365.mail.send($mail)

For a complete walkthrough, see the Tutorial: Authenticate to the Microsoft Graph API in service mode.

Documentation

Authentication

Page Description
New OAuth2 provider Method that instantiates an OAuth2Provider object.
OAuth2Provider Core OAuth 2.0 client: token acquisition, refresh, PKCE, and JWT generation.
JWT Create, sign, and verify JSON Web Tokens.

Microsoft 365 (Microsoft Graph)

Page Description
New Office365 provider Method that instantiates an Office365 object.
Office365 Entry-point facade exposing the mail, calendar, user, and category clients.
Office365Mail Send, read, move, copy, reply, update, and delete messages; manage folders.
Office365Calendar Manage calendars and events.
Office365User Read Azure AD user profiles.
Office365Category Read Outlook master categories.

Google Workspace

Page Description
Google Entry-point facade exposing the mail, calendar, and user clients.
GoogleMail Send, read, and manage Gmail messages and labels.
GoogleCalendar Manage Google calendars and events.
GoogleUser Read Google user profiles (People API).

Notifications

Page Description
GraphNotification / GraphNotificationHandler Microsoft Graph change notifications for mail and calendar.
GoogleNotification / GoogleNotificationHandler Google change notifications for mail and calendar.

(c) Microsoft, Microsoft Office, Microsoft 365, Microsoft Graph are trademarks of the Microsoft group of companies.

(c) Google, Gmail are trademarks of the Alphabet, Inc.

About

4D NetKit is a 4D component that allows you to interact with third-party web services and their APIs.

Topics

Resources

License

Contributing

Stars

18 stars

Watchers

10 watching

Forks

Packages

 
 
 

Contributors