[GH-ISSUE #45] Adding option for users to not have Photo in signature #13

Closed
opened 2026-02-27 20:30:48 +03:00 by kerem · 3 comments
Owner

Originally created by @dakolta on GitHub (Jul 29, 2022).
Original GitHub issue: https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/issues/45

Although all users have photos in AzureAD we have a few that do not want to have their photo in the signature.
I tried adding a code to a extensionattribute and used the following in the custom replacement file:

$ReplaceHash['$CURRENTUSERPHOTODELETEEMPTY$'] = if ($ADPropsCurrentUser.extensionattribute4.Contains("np")) {""}else{$ADPropsCurrentUser.thumbnailphoto}

But it seems to have no effect, the photo is still being loaded.
script-output.txt

Originally created by @dakolta on GitHub (Jul 29, 2022). Original GitHub issue: https://github.com/Set-OutlookSignatures/Set-OutlookSignatures/issues/45 Although all users have photos in AzureAD we have a few that do not want to have their photo in the signature. I tried adding a code to a extensionattribute and used the following in the custom replacement file: ``` $ReplaceHash['$CURRENTUSERPHOTODELETEEMPTY$'] = if ($ADPropsCurrentUser.extensionattribute4.Contains("np")) {""}else{$ADPropsCurrentUser.thumbnailphoto} ``` But it seems to have no effect, the photo is still being loaded. [script-output.txt](https://github.com/GruberMarkus/Set-OutlookSignatures/files/9221856/script-output.txt)
kerem closed this issue 2026-02-27 20:30:49 +03:00
Author
Owner

@GruberMarkus commented on GitHub (Jul 29, 2022):

I will not add a general option to Set-OutlookSignatures for this because of the incredible amount of possible trigger conditions.

You will have to create a custom configuration file. You can find instructions and recommendations for this directly in '.\config\default replacement variables.ps1'.

You are on the right track with your PowerShell code, it just contains a few errors. The following code is working:

$ReplaceHash['$CURRENTUSERPHOTO$'] = $(if ($ADPropsCurrentUser.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUser.thumbnailphoto })
$ReplaceHash['$CURRENTUSERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentUser.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUser.thumbnailphoto })

$ReplaceHash['$CURRENTUSERMANAGERPHOTO$'] = $(if ($ADPropsCurrentUserManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUserManager.thumbnailphoto })
$ReplaceHash['$CURRENTUSERMANAGERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentUserManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUserManager.thumbnailphoto })

$ReplaceHash['$CURRENTMAILBOXPHOTO$'] = $(if ($ADPropsCurrentMailbox.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailbox.thumbnailphoto })
$ReplaceHash['$CURRENTMAILBOXPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentMailbox.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailbox.thumbnailphoto })

$ReplaceHash['$CURRENTMAILBOXMANAGERPHOTO$'] = $(if ($ADPropsCurrentMailboxManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailboxManager.thumbnailphoto })
$ReplaceHash['$CURRENTMAILBOXMANAGERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentMailboxManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailboxManager.thumbnailphoto })

Extension attribute 4 is queried with case insensitivity - if you want case sensitivity, change "-eq" to "-ceq".
Extension attribute must only contain the string 'np', no other characters - if you another comparison method, use '-like', '.contains' et al.
With the sample code above, your users wish to not use their photo in a signature is respected in any possible use case.

Please let me know if this solves your problem and this issue can be closed.

<!-- gh-comment-id:1199911127 --> @GruberMarkus commented on GitHub (Jul 29, 2022): I will not add a general option to Set-OutlookSignatures for this because of the incredible amount of possible trigger conditions. You will have to create a custom configuration file. You can find instructions and recommendations for this directly in '.\config\default replacement variables.ps1'. You are on the right track with your PowerShell code, it just contains a few errors. The following code is working: ``` $ReplaceHash['$CURRENTUSERPHOTO$'] = $(if ($ADPropsCurrentUser.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUser.thumbnailphoto }) $ReplaceHash['$CURRENTUSERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentUser.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUser.thumbnailphoto }) $ReplaceHash['$CURRENTUSERMANAGERPHOTO$'] = $(if ($ADPropsCurrentUserManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUserManager.thumbnailphoto }) $ReplaceHash['$CURRENTUSERMANAGERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentUserManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentUserManager.thumbnailphoto }) $ReplaceHash['$CURRENTMAILBOXPHOTO$'] = $(if ($ADPropsCurrentMailbox.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailbox.thumbnailphoto }) $ReplaceHash['$CURRENTMAILBOXPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentMailbox.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailbox.thumbnailphoto }) $ReplaceHash['$CURRENTMAILBOXMANAGERPHOTO$'] = $(if ($ADPropsCurrentMailboxManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailboxManager.thumbnailphoto }) $ReplaceHash['$CURRENTMAILBOXMANAGERPHOTODELETEEMPTY$'] = $(if ($ADPropsCurrentMailboxManager.extensionattribute4 -eq 'np') { $null } else { $ADPropsCurrentMailboxManager.thumbnailphoto }) ``` Extension attribute 4 is queried with case insensitivity - if you want case sensitivity, change "-eq" to "-ceq". Extension attribute must only contain the string 'np', no other characters - if you another comparison method, use '-like', '.contains' et al. With the sample code above, your users wish to not use their photo in a signature is respected in any possible use case. Please let me know if this solves your problem and this issue can be closed.
Author
Owner

@dakolta commented on GitHub (Jul 29, 2022):

I'm sorry I did not for you to add an option for that purpose, I meant I was trying to add that option.
Your example works, I changed it to be .contains('np') because they also wanted to allow for users to include their mobile phone and I wanted to use the same extensionattribute for that and any other options they wanted.
I did not realize that I had to do both CURRENTUSERPHOTO and CURRENTUSERPHOTODELETEEMPTY, otherwise it still inserts the picture.
Thank you

<!-- gh-comment-id:1199944597 --> @dakolta commented on GitHub (Jul 29, 2022): I'm sorry I did not for you to add an option for that purpose, I meant I was trying to add that option. Your example works, I changed it to be .contains('np') because they also wanted to allow for users to include their mobile phone and I wanted to use the same extensionattribute for that and any other options they wanted. I did not realize that I had to do both $CURRENTUSERPHOTO$ and $CURRENTUSERPHOTODELETEEMPTY$, otherwise it still inserts the picture. Thank you
Author
Owner

@GruberMarkus commented on GitHub (Jul 29, 2022):

You do not need to set both the PHOTO and PHOTODELETEEMPTY variables, it depends which variable you use in your signature template. The README file describes the difference between the variables:

If there is no photo available in Active Directory, there are two options:

  • You used the $CURRENT[...]PHOTO\$ variables: The sample image used as placeholder is shown in the signature.
  • You used the $CURRENT[...]PHOTODELETEEMPTY$ variables: The sample image used as placeholder is deleted from the signature, which may affect the layout of the remaining signature depending on your formatting options.

Closing issue, as it is solved successfully.

<!-- gh-comment-id:1199948855 --> @GruberMarkus commented on GitHub (Jul 29, 2022): You do not need to set both the PHOTO and PHOTODELETEEMPTY variables, it depends which variable you use in your signature template. The README file describes the difference between the variables: >If there is no photo available in Active Directory, there are two options: >- You used the `$CURRENT[...]PHOTO\$` variables: The sample image used as placeholder is shown in the signature. >- You used the `$CURRENT[...]PHOTODELETEEMPTY$` variables: The sample image used as placeholder is deleted from the signature, which may affect the layout of the remaining signature depending on your formatting options. Closing issue, as it is solved successfully.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Set-OutlookSignatures-Set-OutlookSignatures#13
No description provided.