Skip to content

Cannot send email with Send-MgUserMail after updating to 2.26.0 #3163

@rdvanto2

Description

@rdvanto2

Describe the bug

Unable to send mail with version 2.26.0, after upgrading i get this error message:

Send-MgUserMail_Send: Invalid character after parsing property name. Expected ':' but got: ". Path
'Message.ccRecipients[0].emailAddress', line 8, position 28.

Expected behavior

I would like the mail to send without error. This works fine if version 2.25.0

How to reproduce

execute Send-MgUserMail with users in the CcRecipients. I am running powershell 7.5.0 on Redhat Linux

$params = @{
message = @{
subject = "Meet for lunch?"
body = @{
contentType = "Text"
content = "The new cafeteria is open."
}
toRecipients = @(
@{
emailAddress = @{
address = "[email protected]"
}
}
)
ccRecipients = @(
@{
emailAddress = @{
address = "[email protected]"
}
}
)
}
saveToSentItems = "false"
}

Send-MgUserMail -UserId $FromUser -BodyParameter $params -debug

SDK Version

2.26.0

Latest version known to work for scenario above?

2.25.0

Known Workarounds

none

Debug output

Click to expand log DEBUG: [CmdletBeginProcessing]: - Send-MgUserMail begin processing with parameterSet 'Send'. DEBUG: [Authentication]: - AuthType: 'UserProvidedAccessToken', TokenCredentialType: 'UserProvidedAccessToken', ContextScope: 'Process', AppName: 'xyz.Com'. DEBUG: [Authentication]: - Scopes: [Mail.Send].

DEBUG: [CmdletException]: Received exception with message 'JsonReaderException - Invalid character after parsing property name. Expected ':' but got: ". Path 'Message.ccRecipients[0].emailAddress', line 8, position 28. : at Newtonsoft.Json.JsonTextReader.ParseProperty()
at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Microsoft.Graph.PowerShell.UsersActions.UserSendMail(String userId, IDictionary headers, IComponentsVsh1S1RequestbodiesSendmailrequestbodyContentApplicationJsonSchema body, Func2 on2Xx, Func3 onDefault, IEventListener eventListener, ISendAsync sender)
at Microsoft.Graph.PowerShell.Cmdlets.SendMgUserMail_Send.ProcessRecordAsync()'
Send-MgUserMail_Send: Invalid character after parsing property name. Expected ':' but got: ". Path 'Message.ccRecipients[0].emailAddress', line 8, position 28.
DEBUG: [CmdletEndProcessing]: - Send-MgUserMail end processing.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions