summaryrefslogtreecommitdiff
path: root/userphotos/Upload-Photo-demo.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'userphotos/Upload-Photo-demo.ps1')
-rwxr-xr-xuserphotos/Upload-Photo-demo.ps137
1 files changed, 37 insertions, 0 deletions
diff --git a/userphotos/Upload-Photo-demo.ps1 b/userphotos/Upload-Photo-demo.ps1
new file mode 100755
index 0000000..3a85281
--- /dev/null
+++ b/userphotos/Upload-Photo-demo.ps1
@@ -0,0 +1,37 @@
+# Filename: \\util201\scripts\Associate Photos\test\Upload-Photo-demo.ps1
+# License: CC-BY-SA 4.0
+# Author: bgstack15
+# Startdate: 2019-11-07 16:11
+# Title: Upload-Photo
+# Purpose: To demonstrate how to use the User Photo library
+# History:
+# 2019-11-08.04 Complete session management and photo upload/download for AD, AzureAD, and Outlook
+# Usage:
+# Reference:
+# https://richardjgreen.net/set-thumbnailphoto-active-directory-powershell/
+# __Resize function https://seanonit.wordpress.com/2014/11/11/understanding-byte-arrays-in-powershell/
+# A variant of the previous https://www.lewisroberts.com/2015/01/18/powershell-image-resize-function/
+# Filename manipulation https://www.reddit.com/r/PowerShell/comments/3ro9ow/removing_the_end_of_a_filename_with_powershell/
+# https://devblogs.microsoft.com/scripting/weekend-scripter-exporting-and-importing-photos-in-active-directory/
+# Azure AD takes 500kb photos https://support.microsoft.com/en-us/help/3062745/user-photos-aren-t-synced-from-the-on-premises-environment-to-exchange
+# Improve:
+# Documentation
+
+. \\util201\scripts\Functions\userphotolib.ps1
+
+# almost works; a permission isusue?
+#Set-Photo-AzureAD -User bgstack15 -Filename "E:\test\thomas-magnum.PNG"
+
+# OPEN SESSIONS
+$null = Open-Connection-AzureAD
+$null = Import-PSSession ($session = Open-Connection-Outlook) -AllowClobber
+
+# MAIN
+#Set-Photo-All -User "bgstack15" -Filename "E:\test\Notre Dame.jpg"
+
+Set-Photo-All -User "bgstack15" -Filename "E:\test\thomas-magnum.PNG"
+#Get-Photo-All -User "bgstack15" -Filename "E:\test\out.jpg"
+
+# CLOSE SESSIONS
+Close-Connection-AzureAD
+Close-Connection-Outlook $session
bgstack15