People Data Upload

This documentation walk-through the options to extract people data from Active Directory, then upload the data to Indoor Finders. 

Option 1: Windows command-line Tool

Windows command-line tools for export employee data and photo from Active Directory, then import into Indoor Finders system.

Data Export Script:  

Data Upload Script:

 

Scheduled Task: Admin can setup Windows scheduled task to run the batch file 0-SyncNow.cmd, which will call all three batch files of export user data, import user data, and import user photos to Indoor Finders instance.

 

Option 2: PowerShell Command

PowerShell command to export employee data and photo from Office 365, then import into Indoor Finders system. 

Install and run ExchangeOnlineManagement Module

Option 1: Export User list from Exchange Online & upload to Indoor Finders People Finder

#Export
PS> $MBXs = Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox |
 select Identity,DisplayName,PrimarySmtpAddress
 &{foreach ($MBX in $MBXs){
  $User = Get-User $MBX.Identity 
  New-Object psobject -Property @{
                                   Identity = $MBX.Identity
                                   Email = $MBX.PrimarySmtpAddress
                                   DisplayName = $MBX.DisplayName 
                                   FirstName = $User.FirstName
                                   LastName = $User.LastName
                                   JobTitle = $User.Title
                                   Department = $User.Department
                                   PrimaryOfficeLocation = $User.Office
                                   MgrName = $User.Manager
                                   Phone = $User.Phone
                                   MobilePhone = $User.MobilePhone
                                   OtherPhone = $User.OtherTelephone                               
                                   }
    } 
  }| export-csv "C:\DataSync\UserList.csv" -notype

#Import
PS> [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
PS> $wc = new-object System.Net.WebClient
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeopleDataUpload.ashx?key=YOU-API-KEY&cleanupAction=delete","c:\DataSync\UserList.csv")
 

Option 2: Export User and Photo from Exchange Online & Upload to Indoor Finders People Finder

#Export

PS> $MBXs = Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox |
 select Identity,DisplayName,PrimarySmtpAddress
 &{foreach ($MBX in $MBXs){
     $wc.DownloadFile("https://Outlook.Office365.com/ews/Exchange.asmx/s/GetUserPhoto?email="+$MBX.PrimarySmtpAddress+"&size=HR240x240","C:\DataSync\Photo\"+$MBX.PrimarySmtpAddress+".jpg")
  $User = Get-User $MBX.Identity 
  New-Object psobject -Property @{
                                   Identity = $MBX.Identity
                                   Email = $MBX.PrimarySmtpAddress
                                   DisplayName = $MBX.DisplayName 
                                   FirstName = $User.FirstName
                                   LastName = $User.LastName
                                   JobTitle = $User.Title
                                   Department = $User.Department
                                   PrimaryOfficeLocation = $User.Office
                                   MgrName = $User.Manager
                                   Phone = $User.Phone
                                   MobilePhone = $User.MobilePhone
                                   OtherPhone = $User.OtherTelephone                               
                                   }
    } 
  }| export-csv "C:\DataSync\UserlistPhoto.csv" -notype


#Zip photos

PS> Compress-Archive -Force -Path C:\IFS\ScheduleTasks\Aerohive\Photo\*.* -DestinationPath c:\DataSync\Photos.zip


#Import

PS> [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
PS> $wc = new-object System.Net.WebClient
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeopleDataUpload.ashx?key=YOUR-API-KEY&cleanupAction=delete","C:\DataSync\UserListPhoto.csv")
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeoplePhotoBulkUpload.ashx?key=YOUR-API-KEY","C:\DataSync\Photos.zip")

 

Option 3: Secure File Transfer (SFTP)