Classes_v1.PS1

Enum GraphautomaticRepliesStatus_v1 {
        disabled = 0
        alwaysEnabled = 1
        scheduled = 2
}

Enum GraphcalendarColor_v1 {
        lightBlue = 0
        lightGreen = 1
        lightOrange = 2
        lightGray = 3
        lightYellow = 4
        lightTeal = 5
        lightPink = 6
        lightBrown = 7
        lightRed = 8
        maxColor = 9
        auto = -1
}

Enum GraphexternalAudienceScope_v1 {
        none = 0
        contactsOnly = 1
        all = 2
}

Class GraphlocaleInfo_v1 { #
    [string]$locale
    [string]$displayName
}

Class GraphdateTimeTimeZone_v1 { #
    [string]$dateTime
    [string]$timeZone
}

Class GraphprovisionedPlan_v1 { #
    [string]$capabilityStatus
    [string]$provisioningStatus
    [string]$service
}

Class GraphassignedLicense_v1 { #
    [System.Nullable[guid][]]$disabledPlans
    [System.Nullable[guid]]$skuId
}

Class GraphassignedPlan_v1 { #
    [System.Nullable[datetime]]$assignedDateTime
    [string]$capabilityStatus
    [string]$service
    [System.Nullable[guid]]$servicePlanId
}

Class GraphpasswordProfile_v1 { #
    [string]$password
    [System.Nullable[bool]]$forceChangePasswordNextSignIn
}

Class GraphautomaticRepliesSetting_v1 { #
    [GraphautomaticRepliesStatus_v1]$status
    [GraphexternalAudienceScope_v1]$externalAudience
    [GraphdateTimeTimeZone_v1]$scheduledStartDateTime
    [GraphdateTimeTimeZone_v1]$scheduledEndDateTime
    [string]$internalReplyMessage
    [string]$externalReplyMessage
    automaticRepliesSetting_v1() {
        $this.status = New-Object GraphautomaticRepliesStatus_v1
        $this.externalAudience = New-Object GraphexternalAudienceScope_v1
        $this.scheduledStartDateTime = New-Object GraphdateTimeTimeZone_v1
        $this.scheduledEndDateTime = New-Object GraphdateTimeTimeZone_v1
    }
}

Class GraphmailboxSettings_v1 { #
    [GraphautomaticRepliesSetting_v1]$automaticRepliesSetting
    [string]$timeZone
    [GraphlocaleInfo_v1]$language
    mailboxSettings_v1() {
        $this.automaticRepliesSetting = New-Object GraphautomaticRepliesSetting_v1
        $this.language = New-Object GraphlocaleInfo_v1
    }
}

Class Graphuser_v1 {
    [string]$id
    [System.Nullable[bool]]$accountEnabled
    [GraphassignedLicense_v1[]]$assignedLicenses
    [GraphassignedPlan_v1[]]$assignedPlans
    [string[]]$businessPhones
    [string]$city
    [string]$companyName
    [string]$country
    [string]$department
    [string]$displayName
    [string]$givenName
    [string]$jobTitle
    [string]$mail
    [string]$mailNickname
    [string]$mobilePhone
    [string]$onPremisesImmutableId
    [System.Nullable[datetime]]$onPremisesLastSyncDateTime
    [string]$onPremisesSecurityIdentifier
    [System.Nullable[bool]]$onPremisesSyncEnabled
    [string]$passwordPolicies
    [GraphpasswordProfile_v1]$passwordProfile
    [string]$officeLocation
    [string]$postalCode
    [string]$preferredLanguage
    [GraphprovisionedPlan_v1[]]$provisionedPlans
    [string[]]$proxyAddresses
    [string]$state
    [string]$streetAddress
    [string]$surname
    [string]$usageLocation
    [string]$userPrincipalName
    [string]$userType
    [GraphmailboxSettings_v1]$mailboxSettings
    [string]$aboutMe
    [System.Nullable[datetime]]$birthday
    [System.Nullable[datetime]]$hireDate
    [string[]]$interests
    [string]$mySite
    [string[]]$pastProjects
    [string]$preferredName
    [string[]]$responsibilities
    [string[]]$schools
    [string[]]$skills
    user_v1() {
        $this.passwordProfile = New-Object GraphpasswordProfile_v1
        $this.mailboxSettings = New-Object GraphmailboxSettings_v1
    }
    [object[]]Get_ownedDevices() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/ownedDevices" -scope 'User.Read.All')
    }
    [object[]]Get_registeredDevices() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/registeredDevices" -scope 'User.Read.All')
    }
    [object[]]Get_manager() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/manager" -scope 'User.Read.All')
    }
    [object[]]Get_directReports() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/directReports" -scope 'User.Read.All')
    }
    [object]Get_memberOf() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/memberOf" -scope 'User.Read.All')
    }
    [object[]]Get_createdObjects() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/createdObjects")
    }
    [object[]]Get_ownedObjects() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/ownedObjects")
    }
    [object[]]Get_messages() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/messages")
    }
    [object[]]Get_mailFolders() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/mailFolders")
    }
    [object]Get_calendar() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/calendar" -Class 'Graphcalendar_v1' -scope 'Calendars.ReadWrite')
    }
    [object[]]Get_calendars() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/calendars" -Class 'Graphcalendar_v1' -scope 'Calendars.ReadWrite')
    }
    Get_calendarGroups() {
        #Collection(microsoft.graph.calendarGroup)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/calendarGroups"
    }
    Get_calendarView() {
        #Collection(microsoft.graph.event)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/calendarView"
    }
    Get_events() {
        #Collection(microsoft.graph.event)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/events"
    }
    Get_contacts() {
        #Collection(microsoft.graph.contact)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/contacts"
    }
    Get_contactFolders() {
        #Collection(microsoft.graph.contactFolder)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/contactFolders"
    }
    Get_inferenceClassification() {
        #microsoft.graph.inferenceClassification
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/inferenceClassification"
    }
    Get_photo() {
        #microsoft.graph.profilePhoto
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/photo"
    }
    Get_drive() {
        #microsoft.graph.drive
        write-host "users/$($this.Id)/drive"
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/drive"
    }
    Get_drives() {
        #Collection(microsoft.graph.drive)
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.Id)/drives"
    }
    Assign_Manager($ManagerID) {
        $json = "{`"@odata.id`": `"https://graph.microsoft.com/v1.0/users/$($ManagerID)`"}"
        Invoke-GraphMethod -Version 'v1.0' -query "users/$($this.id)/manager/`$ref" -scope 'User.ReadWrite.All' -method 'Put' -body $json -ContentType 'application/json'
    }
}
 
Class Graphcalendar_v1 {
    [string]$id
    [string]$name
    [GraphcalendarColor_v1]$color
    [string]$changeKey
    calendar_v1() {
        $this.color = New-Object GraphcalendarColor_v1
    }
    [object]Get_events() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "calendars/$($this.Id)/events")
    }
    [object]Get_calendarView() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "calendars/$($this.Id)/calendarView")
    }
    [object[]]Get_singleValueExtendedProperties() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "calendars/$($this.Id)/singleValueExtendedProperties")
    }
    [object]Get_multiValueExtendedProperties() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "calendars/$($this.Id)/multiValueExtendedProperties")
    }
}
 
Class GraphalternativeSecurityId_v1 { #
    [System.Nullable[int]]$type
    [string]$identityProvider
    [object]$key
}
 
Class Graphdevice_v1 {
    [string]$id
    [System.Nullable[bool]]$accountEnabled
    [GraphalternativeSecurityId_v1[]]$alternativeSecurityIds
    [System.Nullable[datetime]]$approximateLastSignInDateTime
    [string]$deviceId
    [string]$deviceMetadata
    [System.Nullable[int]]$deviceVersion
    [string]$displayName
    [System.Nullable[bool]]$isCompliant
    [System.Nullable[bool]]$isManaged
    [System.Nullable[datetime]]$onPremisesLastSyncDateTime
    [System.Nullable[bool]]$onPremisesSyncEnabled
    [string]$operatingSystem
    [string]$operatingSystemVersion
    [string[]]$physicalIds
    [string]$trustType
    Get_registeredOwners() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "devices/$($this.Id)/registeredOwners"
    }
    Get_registeredUsers() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "devices/$($this.Id)/registeredUsers"
    }
}
 
Class Graphgroup_v1 { # microsoft.graph.directoryObject
    [string]$id
    [string]$description
    [string]$displayName
    [string[]]$groupTypes
    [string]$mail
    [System.Nullable[bool]]$mailEnabled
    [string]$mailNickname
    [System.Nullable[datetime]]$onPremisesLastSyncDateTime
    [string]$onPremisesSecurityIdentifier
    [System.Nullable[bool]]$onPremisesSyncEnabled
    [string[]]$proxyAddresses
    [System.Nullable[bool]]$securityEnabled
    [string]$visibility
    [System.Nullable[bool]]$allowExternalSenders
    [System.Nullable[bool]]$autoSubscribeNewMembers
    [System.Nullable[bool]]$isSubscribedByMail
    [System.Nullable[int]]$unseenCount
    Get_members() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/members"
    }
    Get_memberOf() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/memberOf"
    }
    Get_createdOnBehalfOf() {
        #microsoft.graph.directoryObject
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/createdOnBehalfOf"
    }
    Get_owners() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/owners"
    }
    Get_threads() {
        #Collection(microsoft.graph.conversationThread)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/threads"
    }
    Get_calendar() {
        #microsoft.graph.calendar
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/calendar"
    }
    Get_calendarView() {
        #Collection(microsoft.graph.event)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/calendarView"
    }
    Get_events() {
        #Collection(microsoft.graph.event)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/events"
    }
    Get_conversations() {
        #Collection(microsoft.graph.conversation)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/conversations"
    }
    Get_photo() {
        #microsoft.graph.profilePhoto
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/photo"
    }
    Get_acceptedSenders() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/acceptedSenders"
    }
    Get_rejectedSenders() {
        #Collection(microsoft.graph.directoryObject)
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/rejectedSenders"
    }
    Get_drive() {
        #microsoft.graph.drive
        Invoke-GraphMethod -Version 'v1.0' -query "groups/$($this.Id)/drive"
    }
}
 
Class GraphdirectoryRole_v1 { # microsoft.graph.directoryObject
    [string]$id
    [string]$description
    [string]$displayName
    [string]$roleTemplateId
    [object[]] Get_members() {
        return (Invoke-GraphMethod -Version 'v1.0' -query "directoryRoles/$($this.Id)/members" -scope 'Users.Read.All')
    }
}