Mailbox Junk Email Configuration - Unable To Remove Trusted Senders and Domain PS

VLY 21 Reputation points
2022-11-23T21:03:07.963+00:00

Greetings,

I've been working on trying to add a particular domain and e-mail to my organization's Safe Senders list for everyone to show up in their Outlook junk email options settings. I can configure for a user with the below command but trying to remove will throw an unusual error. This doesn't happen to all users just some so not sure what's the common denominator here. Can someone please provide some insight and a solution? Thanks in advance for your feedback!

Add trusted domain and e-mail -- this is working in adding the values in Outlook for all user

Set-MailboxJunkEmailConfiguration -Identity john.doe@Company portal .com -TrustedSendersAndDomains @{Add="trust.domain.com","no-reply@trust .domain.com"}

Remove trusted domain and e-mail --- this is failing trying to remove the value in Outlook for some users

Set-MailboxJunkEmailConfiguration -Identity john.doe@Company portal .com -TrustedSendersAndDomains @{Remove="trust.domain.com","no-reply@trust .domain.com"}

Error:

Write-ErrorMessage : |Microsoft.Exchange.Configuration.CmdletProxyException|Error on proxy command 'Set-MailboxJunkEmailConfiguration -Identity:'john.doe@Company portal .com' -TrustedSendersAndDomains:@{'Remove' = 'trust.domain.com'; '-' = 'no-reply@trust .domain.com'} -Confirm:$False' to server DM6PR01MB5611.prod.exchangelabs.com: Server
version 15.01.0000.0000, Proxy method PSWS:
BadRequest: Invalid Operation : {
"code": "BadRequest",
"message": "Invalid Operation",
"innererror": {
"message": "Invalid Operation",
"type": "Microsoft.Exchange.Admin.OData.Core.ODataServiceException",
"stacktrace": " at Microsoft.Exchange.AdminApi.CommandInvocation.CommandInvocation.InvokeCommand(QueryContext queryContext, CmdletInvokeInputType cmdletInvokeInputType)\r\n at Microsoft.Exchange.Admin.OData.Core.PathSegmentToExpressionTranslator.Translate(OperationImportSegment segment)\r\n at
Microsoft.Exchange.Admin.OData.Core.QueryContext.ResolveQuery(ODataContext context, Int32 level)\r\n at Microsoft.Exchange.Admin.OData.Core.Handlers.OperationHandler.Process(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)\r\n at Microsoft.Exchange.Admin.OData.Core.Handlers.RequestHandler.Process(Stream
requestStream)",
"internalexception": {
"message": "Cannot process argument transformation on parameter 'TrustedSendersAndDomains'. Cannot convert value \"System.Collections.Generic.Dictionary2[System.String,System.Object]\" to type \"Microsoft.Exchange.Data.MultiValuedProperty1[System.String]\". Error: \"MultiValuedProperty collections cannot contain null
values.\r\nParameter name: item\"",
"type": "Microsoft.Exchange.AdminApi.CommandInvocation.ParameterTransformationException",
"stacktrace": ""
}
}
} [Server=GVXP194MB1808,RequestId=326cf62d-f324-e276-19d6-bc9e7f684b8b,TimeStamp=11/23/2022 8:39:19 PM] .
At C:\Users\vly\AppData\Local\Temp\tmpEXO_ab2delz0.rbx\tmpEXO_ab2delz0.rbx.psm1:1097 char:13

  • Write-ErrorMessage $ErrorObject
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Set-MailboxJunkEmailConfiguration], CmdletProxyException
  • FullyQualifiedErrorId : [Server=GVXP194MB1808,RequestId=326cf62d-f324-e276-19d6-bc9e7f684b8b,TimeStamp=Wed, 23 Nov 2022 20:39:18 GMT],Write-ErrorMessage

My Outlook comes with these default Safe Senders and I'm not sure where this is coming from. If I can figure out where this is configured, it would be better to just add my list to this vs Exchange PS method.

defender-noreply@microsoft.com
microsoft-noreply@microsoft.com
noreply@emeaemail.teams.microsoft.com
o365sup2@microsoft.com

Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,915 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,221 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
1,905 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Joy Zhang-MSFT 1,046 Reputation points
    2022-11-24T02:25:47.743+00:00

    Hi @VLY

    Based on information you provided, here are some troubleshooting steps for your reference and hope these help:

    1. According to below error messages you posted, I have noticed that there is null value "-" in the command, you may check if you are typing this null value accidently. Re-run the command and see if the issue continues. Set-MailboxJunkEmailConfiguration -Identity john -TrustedSendersAndDomains @{Remove="trust.domain.com","no-reply@trust .domain.com"}

    Write-ErrorMessage : |Microsoft.Exchange.Configuration.CmdletProxyException|Error on proxy command 'Set-MailboxJunkEmailConfiguration -Identity:'john.doe@Company portal .com' -TrustedSendersAndDomains:@{'Remove' = 'trust.domain.com'; '-' = 'no-reply@trust .domain.com'} -Confirm:$False' to server DM6PR01MB5611.

    1. If above command still cannot work for you, you could try to remove sender list in outlook client side. (Open outlook -> Home ->Junk -> Junk E-mail option ->safe senders)
      263734-1.png

    My Outlook comes with these default Safe Senders and I'm not sure where this is coming from. If I can figure out where this is configured, it would be better to just add my list to this vs Exchange PS method.

    Admin audit log may be help to your issue, you could search admin audit log in EAC or powershell then you will see who has run the command Set-MailboxJunkEmailConfiguration to add or remove safe sender list.


    If an Answer is helpful, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Andy David - MVP 142.5K Reputation points MVP
    2022-11-26T12:37:23.19+00:00

    It sounds like you dont have the Exchange Permissions to do this for other accounts.
    If you do , you could always try connecting with the RPSsession switch to see if makes a difference

    Connect-ExchangeOnline -UserPrincipalName chris@contoso.com -UseRPSSession  
    

    however, having said that, I would not bother adding safe senders to every mailbox. Why not just safe list the entry with a transport rule or the Tenant Allow List? Recommnended and much easier to manage:

    https://learn.microsoft.com/en-us/microsoft-365/security/office-365-security/create-safe-sender-lists-in-office-365?view=o365-worldwide

    0 comments No comments

  3. VLY 21 Reputation points
    2022-11-29T22:24:59.53+00:00

    Thank you for the response. The issue I am facing is the link below where the e-mail isn't going into the junk folder but in the inbox. However, I'm not able to trust the sender to where the e-mail being delivered to the inbox would automatically display the images, etc. I have tried to add the sender domain and e-mail via the suggest Tenant Allow List and the Anti-spam configuration, as well as Mail flow rule with no luck to completely trust the message without restrictions.

    https://community.spiceworks.com/topic/2318540-how-and-where-to-configure-safe-senders-list-for-everyone