Forum Discussion

jcasqueiro's avatar
jcasqueiro
Brass Contributor
Oct 13, 2023

Exporting users to a csv file with all attributes (normal and extended)

Hi,

In  O365 I can export all tenant users to a csv file through the admin console but the extended attributes don't show up.

Is there  script that allows me to create a csv file with all the users, including normal and extended attributes?

Thanks/Brgds

joo

  • Extension attributes can only be fetched via the Graph cmdlets, and you need to specifically request them. So something like this:

    Get-MgBetaUser -UserId blabla -Property Id,UserPrincipalName, extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType,
    extension_fe2174665583431c953114ff7268b7b3_Education_AnchorId, ... | select Id,UserPrincipalName, extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType,
    extension_fe2174665583431c953114ff7268b7b3_Education_AnchorId, ...
  • Which attributes are you referring to, the set of 15 customAttributeXX? The Graph SDK for PowerShell can be used to export most attributes, including the customAttributeXX ones (they are exposed as part of the OnPremisesExtensionAttributes property). For example:

    Get-MgBetaUser -UserId email address removed for privacy reasons | select -ExpandProperty OnPremisesExtensionAttributes | fl
    • jcasqueiro's avatar
      jcasqueiro
      Brass Contributor
      Hi Vasil,
      I am talking about the ones created by SchoolDataSync in a O365EDU tenant. As far as I can tell, apart from the normal user attributes, the extended ones are:
      extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType
      extension_fe2174665583431c953114ff7268b7b3_Education_AnchorId
      extension_fe2174665583431c953114ff7268b7b3_Education_SyncSource
      extension_fe2174665583431c953114ff7268b7b3_Education_SyncSource_TeacherId
      extension_fe2174665583431c953114ff7268b7b3_Education_TeacherNumber
      extension_fe2174665583431c953114ff7268b7b3_Education_TeacherStatus
      extension_fe2174665583431c953114ff7268b7b3_Education_Title
      extension_fe2174665583431c953114ff7268b7b3_Education_SyncSource_SchoolId
      extension_fe2174665583431c953114ff7268b7b3_Education_Email

      Thanks
      • VasilMichev's avatar
        VasilMichev
        MVP
        Extension attributes can only be fetched via the Graph cmdlets, and you need to specifically request them. So something like this:

        Get-MgBetaUser -UserId blabla -Property Id,UserPrincipalName, extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType,
        extension_fe2174665583431c953114ff7268b7b3_Education_AnchorId, ... | select Id,UserPrincipalName, extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType,
        extension_fe2174665583431c953114ff7268b7b3_Education_AnchorId, ...

Resources