Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Save Email Credentials in Apple Keychain or Windows Credentials ManagerSee more Apple Keychain ExamplesThis example demonstrates how to save (or update) email credentials in the Apple Keychain.
integer li_rc oleobject loo_Secrets oleobject loo_Json integer li_Success // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Secrets = create oleobject // Use "Chilkat_9_5_0.Secrets" for versions of Chilkat < 10.0.0 li_rc = loo_Secrets.ConnectToNewObject("Chilkat.Secrets") if li_rc < 0 then destroy loo_Secrets MessageBox("Error","Connecting to COM object failed") return end if // On Windows, this is the Windows Credentials Manager // On MacOS/iOS, it is the Apple Keychain loo_Secrets.Location = "local_manager" // Specify the name of the secret. // service and username are required. // appName and domain are optional. // Note: The values are arbitrary and can be anything you want. loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("appName","MyEmailApp") loo_Json.UpdateString("service","SMTP") loo_Json.UpdateString("domain","example.com") loo_Json.UpdateString("username","joe@example.com") // Create or update the secret. // This secret is the SMTP password for the above email account. li_Success = loo_Secrets.UpdateSecretStr(loo_Json,"joes_password") if li_Success = 0 then Write-Debug loo_Secrets.LastErrorText destroy loo_Secrets destroy loo_Json return end if // Let's save the IMAP secret for an account we'll read using IMAP.. loo_Json.UpdateString("appName","MyEmailApp") loo_Json.UpdateString("service","IMAP") loo_Json.UpdateString("domain","example2.com") loo_Json.UpdateString("username","jane@example2.com") li_Success = loo_Secrets.UpdateSecretStr(loo_Json,"janes_password") if li_Success = 0 then Write-Debug loo_Secrets.LastErrorText destroy loo_Secrets destroy loo_Json return end if Write-Debug "Success." destroy loo_Secrets destroy loo_Json |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.