Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/OpenDirectory Test


Required plugins for this example: MBS MacFrameworks Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/OpenDirectory Test

This example is the version from Mon, 21th Jul 2019.

Project "OpenDirectory Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() Dim defaultSession As ODSessionMBS = ODSessionMBS.defaultSession Dim error As NSErrorMBS // this picks default node 'Dim node As ODNodeMBS = ODNodeMBS.nodeWithType(defaultSession, ODNodeMBS.kODNodeTypeAuthentication, error) // look in all nodes Dim nodeNames() As String = defaultSession.nodeNames(error) If error <> Nil Then Break MsgBox error.LocalizedDescription End If For Each NodeName As String In nodeNames List.AddRow "NodeName", NodeName Dim node As ODNodeMBS = ODNodeMBS.nodeWithName(defaultSession, nodeName, error) If error <> Nil Then Break MsgBox error.LocalizedDescription End If Dim RecordTypes As Variant = ODRecordMBS.kODRecordTypeUsers Dim AttributeName As String = ODRecordMBS.kODAttributeTypeRecordName Dim matchType As Integer = ODQueryMBS.kODMatchEqualTo Dim queryValues As String = ODSessionMBS.UserName Dim returnAttributes As Variant = ODRecordMBS.kODAttributeTypeStandardOnly dim maximumResults as integer = 0 // all Dim query As ODQueryMBS = ODQueryMBS.queryWithNode(node, RecordTypes, AttributeName, matchType, queryValues, returnAttributes, maximumResults, error) If error <> Nil Then Break MsgBox error.LocalizedDescription End If Dim records() As ODRecordMBS = query.resultsAllowingPartial(False, error) If error <> Nil Then Break MsgBox error.LocalizedDescription End If For Each record As ODRecordMBS In records List.AddRow "RecordName", record.recordName List.AddRow "recordType", record.recordType Dim dic As Dictionary = record.recordDetails(error) If error <> Nil Then Break MsgBox error.LocalizedDescription End If If dic <> Nil Then Dim keys() As Variant = dic.keys For Each key As String In keys Dim values() As Variant = dic.Value(key) Dim valueStrings() As String For Each value As Variant In values Dim vs As String If value IsA MemoryBlock Then Dim m As MemoryBlock = value vs = "MemoryBlock with "+Str(m.size)+" bytes" Else vs = value.StringValue End If valueStrings.Append vs Next List.AddRow key, Join(valueStrings, ", ") Next end if Next Next End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...