大网数据广告活动
域与目录服务

Microsoft Graph API Requests Fail to Get B2B Users Using UPN

· 52CE 我爱测

Provides a solution to an issue where a Microsoft Graph API request fails to get a Business-to-Business (B2B) user using User Principal Name (UPN).

This article provides a solution to an error that occurs when you run a Microsoft Graph API request to get a Business-to-Business (B2B) user using User Principal Name (UPN).

Symptoms

When you execute a Microsoft Graph API request to get a B2B user using UPN, you might encounter an error.

Request example:

https://graph.microsoft.com/v1.0/users/example_gmail.com#EXT#@example.onmicrosoft.com

Response exmaple:

{
"error": {
"code": "Request_ResourceNotFound",
"message": "Resource '<resource-id>' does not exist or one of its queried reference-property objects are not present.",
"innerError": {
"request-id": "<request-id>",
"date": "2019-12-05T23:55:40"
            }
        }
}

Cause

The issue occurs because the # character in the UPN is treated as a special character in the URL. Everything after the # is treated as a fragment and isn't sent over the wire.

Solution

To resolve this issue, you must encode the # character in the UPN as %23.

Here's the correct request format:

https://graph.microsoft.com/v1.0/users/example_gmail.com%23EXT%23@example.onmicrosoft.com

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 06/23/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。