Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) List GroupsList all the groups available in an organization, including but not limited to Office 365 Groups. See https://docs.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0 for more information.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") ; Use your previously obtained access token as shown here: ; Get Microsoft Graph OAuth2 Access Token with Group.ReadWrite.All scope. $oJsonToken = ObjCreate("Chilkat.JsonObject") Local $bSuccess = $oJsonToken.LoadFile("qa_data/tokens/msGraphGroup.json") If ($bSuccess = False) Then ConsoleWrite($oJsonToken.LastErrorText & @CRLF) Exit EndIf $oHttp.AuthToken = $oJsonToken.StringOf("access_token") ; Send a GET request to https://graph.microsoft.com/v1.0/groups?$orderby=displayName Local $strResponse = $oHttp.QuickGetStr("https://graph.microsoft.com/v1.0/groups?$orderby=displayName") If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf $oJson = ObjCreate("Chilkat.JsonObject") $oJson.Load($strResponse) $oJson.EmitCompact = False If ($oHttp.LastStatus <> 200) Then ConsoleWrite($oJson.Emit() & @CRLF) ConsoleWrite("Failed, response status code = " & $oHttp.LastStatus & @CRLF) Exit EndIf ConsoleWrite($oJson.Emit() & @CRLF) ; Sample output: ; (See parsing code below..) ; { ; "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups", ; "value": [ ; { ; "id": "45b7d2e7-b882-4a80-ba97-10b7a63b8fa4", ; "deletedDateTime": null, ; "classification": null, ; "createdDateTime": "2018-12-22T02:21:05Z", ; "creationOptions": [], ; "description": "Self help community for golf", ; "displayName": "Golf Assist", ; "groupTypes": [ ; "Unified" ; ], ; "mail": "golfassist@contoso.com", ; "mailEnabled": true, ; "mailNickname": "golfassist", ; "onPremisesLastSyncDateTime": null, ; "onPremisesSecurityIdentifier": null, ; "onPremisesSyncEnabled": null, ; "preferredDataLocation": "CAN", ; "proxyAddresses": [ ; "smtp:golfassist@contoso.onmicrosoft.com", ; "SMTP:golfassist@contoso.com" ; ], ; "renewedDateTime": "2018-12-22T02:21:05Z", ; "resourceBehaviorOptions": [], ; "resourceProvisioningOptions": [], ; "securityEnabled": false, ; "visibility": "Public", ; "onPremisesProvisioningErrors": [] ; }, ; { ; "id": "d7797254-3084-44d0-99c9-a3b5ab149538", ; "deletedDateTime": null, ; "classification": null, ; "createdDateTime": "2018-11-19T20:29:40Z", ; "creationOptions": [], ; "description": "Talk about golf", ; "displayName": "Golf Discussion", ; "groupTypes": [], ; "mail": "golftalk@contoso.com", ; "mailEnabled": true, ; "mailNickname": "golftalk", ; "onPremisesLastSyncDateTime": null, ; "onPremisesSecurityIdentifier": null, ; "onPremisesSyncEnabled": null, ; "preferredDataLocation": "CAN", ; "proxyAddresses": [ ; "smtp:golftalk@contoso.onmicrosoft.com", ; "SMTP:golftalk@contoso.com" ; ], ; "renewedDateTime": "2018-11-19T20:29:40Z", ; "resourceBehaviorOptions": [], ; "resourceProvisioningOptions": [], ; "securityEnabled": false, ; "visibility": null, ; "onPremisesProvisioningErrors": [] ; } ; ] ; } ; ; Use this online tool to generate parsing code from sample JSON: ; Generate Parsing Code from JSON Local $sOdataContext Local $i Local $iCount_i Local $sId Local $sDeletedDateTime Local $sClassification Local $sCreatedDateTime Local $sDescription Local $sDisplayName Local $sMail Local $bMailEnabled Local $sMailNickname Local $sOnPremisesLastSyncDateTime Local $sOnPremisesSecurityIdentifier Local $sOnPremisesSyncEnabled Local $sPreferredDataLocation Local $sRenewedDateTime Local $bSecurityEnabled Local $sVisibility Local $iJ Local $iCount_j Local $strVal $sOdataContext = $oJson.StringOf("""@odata.context""") $i = 0 $iCount_i = $oJson.SizeOfArray("value") While $i < $iCount_i $oJson.I = $i $sId = $oJson.StringOf("value[i].id") $sDeletedDateTime = $oJson.StringOf("value[i].deletedDateTime") $sClassification = $oJson.StringOf("value[i].classification") $sCreatedDateTime = $oJson.StringOf("value[i].createdDateTime") $sDescription = $oJson.StringOf("value[i].description") $sDisplayName = $oJson.StringOf("value[i].displayName") $sMail = $oJson.StringOf("value[i].mail") $bMailEnabled = $oJson.BoolOf("value[i].mailEnabled") $sMailNickname = $oJson.StringOf("value[i].mailNickname") $sOnPremisesLastSyncDateTime = $oJson.StringOf("value[i].onPremisesLastSyncDateTime") $sOnPremisesSecurityIdentifier = $oJson.StringOf("value[i].onPremisesSecurityIdentifier") $sOnPremisesSyncEnabled = $oJson.StringOf("value[i].onPremisesSyncEnabled") $sPreferredDataLocation = $oJson.StringOf("value[i].preferredDataLocation") $sRenewedDateTime = $oJson.StringOf("value[i].renewedDateTime") $bSecurityEnabled = $oJson.BoolOf("value[i].securityEnabled") $sVisibility = $oJson.StringOf("value[i].visibility") $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].creationOptions") While $iJ < $iCount_j $oJson.J = $iJ ; ... $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].groupTypes") While $iJ < $iCount_j $oJson.J = $iJ $strVal = $oJson.StringOf("value[i].groupTypes[j]") $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].proxyAddresses") While $iJ < $iCount_j $oJson.J = $iJ $strVal = $oJson.StringOf("value[i].proxyAddresses[j]") $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].resourceBehaviorOptions") While $iJ < $iCount_j $oJson.J = $iJ ; ... $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].resourceProvisioningOptions") While $iJ < $iCount_j $oJson.J = $iJ ; ... $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("value[i].onPremisesProvisioningErrors") While $iJ < $iCount_j $oJson.J = $iJ ; ... $iJ = $iJ + 1 Wend $i = $i + 1 Wend ConsoleWrite("Success." & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.