我将使用Microsoft Graph Api获取特定用户的详细信息。
我有一个问题可以通过Graph Explorer演示:https://developer.microsoft.com/en-us/graph/graph-explorer 如果我运行这个查询:
返回以下消息:
发现不兼容类型的二元运算符。操作符种类为“等于”,找到的操作数类型为“Edm.String”和“Edm.Guid”。请注意,该信息保留了HTML标签。
返回以下信息:
未识别的“Edm.String”文字“guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'”在“id eq guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'”中的位置为6。
我有一个问题可以通过Graph Explorer演示:https://developer.microsoft.com/en-us/graph/graph-explorer 如果我运行这个查询:
https://graph.microsoft.com/v1.0/users
我收到了一份用户列表,包含他们的ID。
我知道只需将ID附加到URL上,就可以获取一个用户的详细信息。例如,下面这个查询:
https://graph.microsoft.com/v1.0/users/f71f1f74-bf1f-4e6b-b266-c777ea76e2c7
显示一个特定用户的详细结果。
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"id": "f71f1f74-bf1f-4e6b-b266-c777ea76e2c7",
"businessPhones": [],
"displayName": "CIE Administrator",
"givenName": "CIE",
"jobTitle": null,
"mail": "admin@CIE493742.onmicrosoft.com",
"mobilePhone": "+1 3528700812",
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "Administrator",
"userPrincipalName": "admin@CIE493742.onmicrosoft.com"
}
然而,在我的情况下,对于字段id
应用$filter
查询更容易一些。
以下是我尝试过的内容以及出现的错误:
第一次尝试
.../users?$filter=id eq f71f1f74-bf1f-4e6b-b266-c777ea76e2c7
返回以下消息:
发现不兼容类型的二元运算符。操作符种类为“等于”,找到的操作数类型为“Edm.String”和“Edm.Guid”。请注意,该信息保留了HTML标签。
..../users/$filter=id eq guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'
返回以下信息:
未识别的“Edm.String”文字“guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'”在“id eq guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'”中的位置为6。