Home Service Manager Portal Feature Requests
We appreciate you taking the time to vote and add your suggestions to make our products awesome! Your request will be submitted to the community for review and inclusion into the backlog.

We recommend reviewing what is submitted before posting, in case your idea has already been submitted by another community member. If it has been submitted, vote for that existing feature request (by clicking the up arrow) to increase its opportunity of being added to Cireson solutions.

For more information around feature requests in the Cireson Community click here.

ability to show AD thumbnail photo on Cireson Portal of affected user

Silas_SulserSilas_Sulser Customer Advanced IT Monkey ✭✭✭

Hello

We are working in a big company with more than 1000 users.

Sometimes it would be useful to have a photo of an enduser in the "affected user"-area, to better recognize them in large offices. :)

We've already imported those AD thumbnail photos, so they also appear in Outlook / Skype for Business.

Would that be a big task?

Thanks and best regards

Silas

16 votes

Submitted · Last Updated

Comments

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    edited October 2017
    It seems to me there is perhaps one potential way of accomplishing this (although I haven't tested it myself).

    Using the CustomSpace directory, you create/append HTML tags on the fly based on the presence of the Affected User on a Work item. If it exists, you'll need to pull the image content (I think in AD its stored as a Byte Array. Not sure how/if this translates) and get it into a base64 string format. Then you can dynamically append an HTML image tag with said base64 string to anywhere you want on the page.

    <img src="data:image/png;base64,USERBASE64IMAGESTRINGHERE" />
  • Silas_SulserSilas_Sulser Customer Advanced IT Monkey ✭✭✭
    @Adam_Dzyacky: thanks for your approach! If I find some time, I'll check that out.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    edited October 2017
    Active Directory stores the photos with the "Octet String" data type, in a property simply called "photo". 

    Conceivably, you could extend your user class with this property (probably as a string data type, making sure to make it big enough) and then sync it with AD.

    But to @Adam_Dzyacky's point, you would then need to convert it when displaying.  Each byte is a 2-character representation of an octet, divided by the "\" character each time.  For example, a byte could be 0x00 in hex, and would simply be 00 in this format.  Two bytes of 00 and FF would appear as \00\FF\ in this format.  I am not immediately certain how to convert this to Base64, but it seems like it would be very feasible.
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    edited October 2017
    A $_.GetType() against the ThumbnailPhoto attribute of an AD user shows a type of Byte[] (Byte Array). 



    However what @Tom_Hendricks is saying is also entirely correct. If you were to open up ADSI and look at a user's thumbnailPhoto property, you would see the identical format he describes (i.e. "\00\FF\....") of type Hexidecimal. They are the same exact values, just represented differently.



    So to get that user property into a base64 in PowerShell we can simply do:
    [System.Convert]::ToBase64String($adUserObject.ThumbnailPhoto)

    I took the output of this, dropped it into the aforementioned image tag in a dummy HTML file and can verify it renders correctly. Perhaps the only real distinction worth making here is I'm using ThumbnailPhoto and Tom is pointing out the Photo attribute. Both valid properties on an Active Directory User object!

    So now I'm thinking (in the same way Tom is. What a surprise  ;) )...a class extension on the User class for a "base64imageString", the import/export process performs the aforementioned conversion, and then via CustomSpace you pull this value since Cireson honors class extensions.
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Incredibly hardcoded right now, but very doable.


  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    @Silas_Sulser
    If you already imported the photos so they appear in Outlook and you use Exchange as mail server you could utilize EWS and retrieve the user photo from there. Simply get the photo from the following url:

    https://www.contoso.com/ews/exchange.asmx/s/GetUserPhoto?email=user@contoso.com&size=HR240x240

    More info here: How to: Get user photos by using EWS in Exchange

    Btw, really like the idea so if someone has the time please share your solution!

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Placement wise...right of Affected User? Otherwise, I have a fairly dynamic *.js at this point.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I like both approaches, but had not considered looking at EWS like @Martin_Blomgren suggested.  Not going through the Service Manager SDK seems like a big win for those who do not use the console.  Consider my mind changed.
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Ditto. Leveraging the EWS had never crossed my mind either.
  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    I've already added this to our UAT Environment, using EWS, a cut down version of the code inserted below (i can't post the entire file without getting permission from who i got the base for it from).

    Basically we currently pass the userpicker ID from the form, and the GUID of the entered user when the user picker changes, then insert HTML below it for the data we want displayed. you can see the inserted <img> tag below (although the web address has been changed)

    	var lookupUserId = (userGUID) ? userGUID : "";<br>	$.get("/api/V3/User/GetUserRelatedInfoByUserId", { userId: lookupUserId },<br>	function (data) {<br>		if (data.length > 0)<br>		{<br>			var obj = jQuery.parseJSON( data);<br>			<br>			var strPager = "";<br>			var strNotes = "";<br>			var strTitle = "";<br>			var strOffice = "";<br>			var strStreetAddress = "";					<br>			var strStreetAddress2 = "";<br>			var strBusinessPhone = "";<br>			var strMobile = "";<br>			var strEmailLink = "";<br>			var strManager = "";<br>			//---<br>			if (typeof obj.Email)<br>			{<br>				var emailTo = obj.Email;<br>				var emailCC = "";<br>				strEmailLink = "<a href='mailto:" + emailTo + "'>" + emailTo + "</a>";<br>				$("#" + userPickerId + "_Email").html(strEmailLink);<br>				$("#" + userPickerId + "_IMG").html("<img src='https://ews.exchange.wweb.address.goes.here/EWS/Exchange.asmx/s/GetUserPhoto?email=" + emailTo + "&size=HR96x96'>");<br>			}<br>			else<br>			{<br>				$("#" + userPickerId + "_Email").html("");<br>				$("#" + userPickerId + "_IMG").html("");<br>			}<br><br>



  • Silas_SulserSilas_Sulser Customer Advanced IT Monkey ✭✭✭

    Many thanks to all of you! I'm really overwhelmed by all of your effort!

    I think to use the EWS solution would be easiest way for me.

    The posted code from @Jeff_Lang helps me a lot too.

    Where did you place that code, that it appears in the correct div right below the selected user?

    Did you do that by placing that code in "CustomSpace"-area and calling it from "custom.js"?

    Thanks so much!

  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    @Silas_Sulser
    I just got the ok from @Adrian_Paech to upload the file i am using (It's a modified version of a file i got from him).

    it's in the community uploads section at https://community.cireson.com/discussion/3214/display-customer-information-and-image-from-ews-below-user-name#latest
  • Charles_BurtonCharles_Burton Customer Adept IT Monkey ✭✭
    Photo bubble from AD image attribute would be a value add for our team and our customers. No need for Exchange or O365 attribute extensions since it is built-in to AD. We have seen greater adoption rates with products that integrate social aspects within our organization. 
Sign In or Register to comment.