---
title: Get-Mailbox fails with InputObject argument transformation error in Exchange Online
slug: get-mailbox-fails-with-inputobject-argument-transformation-error-in-exchange-online
createdAt: 2026-05-20T01:29:11.624Z
---

### Issue

When Activate calls Exchange Online using remote PowerShell, a mailbox lookup may fail even though the mailbox exists.

The error can look similar to this:

:::BlockQuote
Cannot process argument transformation on parameter 'InputObject'.

Cannot convert the "@&#x7B;...}" value of type

"Selected.System.Management.Automation.PSCustomObject" to type "Object".
:::

In the observed case, the failing command shown in the exception was:

:::BlockQuote
Get-Mailbox -Identity 'user\@domain.com'
:::

The stack trace showed the error being raised during a user creation workflow, while attempting to retrieve mailbox details from Exchange Online. The returned object contained a very large mailbox payload with many properties, including OData-style metadata fields and collection properties.&#x20;

### Cause

The issue was caused by the size and shape of the object returned by classic Exchange Online Get-Mailbox.

Get-Mailbox returned a large, deserialised mailbox object. During PowerShell object transformation, the Exchange Online/PowerShell layer attempted to process the object as an InputObject, but failed when converting the selected/deserialised PSCustomObject.

This was not caused by an invalid UPN or a missing mailbox. In the captured failure, Exchange had already resolved the mailbox and returned mailbox details, including properties such as PrimarySmtpAddress, RecipientTypeDetails, Identity, and ExchangeGuid.&#x20;

### Affected pattern

The issue can occur with code that calls:

:::BlockQuote
rps.Exec("Get-Mailbox", "Identity", upn)
:::

Activate’s RemotePowerShell.Exec(string command, params object\[] args) creates a PowerShell Command and adds the supplied arguments as name/value parameter pairs. The command is then added to a pipeline and invoked.&#x20;

So the C# call itself is valid. The failure occurs when the Exchange Online command returns or transforms the full mailbox object.

### Resolution

Use Get-EXOMailbox and request only the required property.

For example, when only the Exchange GUID is required:

```csharp
foreach (PSObject o in eol.Exec(
    "Get-EXOMailbox",
    "Identity", upn,
    "Properties", new[] { "ExchangeGuid" }))
{
    var prop = o.Properties["ExchangeGuid"];

    if (prop?.Value == null)
        throw new Exception($"ExchangeGuid was not returned for {upn}");

    if (prop.Value is Guid guid)
        return guid;

    if (Guid.TryParse(prop.Value.ToString(), out Guid parsed))
        return parsed;

    throw new Exception($"ExchangeGuid value was not a valid Guid for {upn}: {prop.Value}");
}
```

This avoids returning the full mailbox object and prevents the object transformation failure.

### Recommended implementation

```csharp
public Guid GetExchangeOnlineGuid(string upn, bool returnError)
{
    ExchangeResourceOnline eol =
        Evaluator.GetObject("=//Resources/Exchange Servers/Office365") as ExchangeResourceOnline;

    if (eol == null)
        throw new Exception("Could not find Exchange Online resource at =//Resources/Exchange Servers/Office365");

    try
    {
        foreach (PSObject o in eol.Exec(
            "Get-EXOMailbox",
            "Identity", upn,
            "Properties", new[] { "ExchangeGuid" }))
        {
            var value = o.Properties["ExchangeGuid"]?.Value;

            if (value == null)
                throw new Exception($"ExchangeGuid was not returned for {upn}");

            if (value is Guid guid)
                return guid;

            if (Guid.TryParse(value.ToString(), out Guid parsed))
                return parsed;

            throw new Exception($"ExchangeGuid value was not a valid Guid for {upn}: {value}");
        }
    }
    catch (Exception ex)
    {
        if (returnError)
            throw new Exception($"Error retrieving ExchangeGuid for {upn}", ex);
    }

    return Guid.Empty;
}
```

### Notes

Use the property name:

:::BlockQuote
ExchangeGuid
:::

Avoid:

:::BlockQuote
ExchangeGUID
:::

Although PowerShell command-line property access is generally case-insensitive, C# PSObject.Properties\[...] lookups should use the exact returned property name.

### Validation steps

1. Run the updated lookup using Get-EXOMailbox.&#x20;
2. Confirm the command requests only the required property:&#x20;

:::BlockQuote
Get-EXOMailbox -Identity user\@domain.com -Properties ExchangeGuid
:::

1. Confirm the result contains ExchangeGuid.&#x20;
2. Confirm the workflow no longer throws the InputObject transformation error.&#x20;
3. Confirm the returned GUID matches the mailbox’s Exchange GUID.&#x20;

### Outcome

Changing the lookup from full Get-Mailbox output to Get-EXOMailbox with only the required ExchangeGuid property reduced the response size and resolved the transformation failure.
