首页 > 解决方案 > MS Graph Angular 按名称搜索用户

问题描述

在我的 Angular 应用程序中,应该有一个在组织内搜索用户的选项。应用程序本身受 MSAL 库保护,访问令牌由 MsalInterceptor 添加到所有请求标头中。

现在我想通过 HttpClientModule 搜索以“Joh”开头的用户:

this.http.get(`https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'Joh')`, { headers: { ConsistencyLevel: 'eventual' } }).subscribe((response: any) => {
  console.log(response);
});

就像这里描述的:https ://docs.microsoft.com/de-de/graph/api/user-list?view=graph-rest-1.0&tabs=http#code-try-15

不幸的是,我面临以下错误:

“在 URI 中指定的查询无效。在类型 'Microsoft.Fast.Profile.Web.Models._1._0.Profile' 上找不到名为 'displayName' 的属性。”

我做错了什么?

标签: angularmicrosoft-graph-apimsal

解决方案


推荐阅读