我需要从Microsoft Graph返回用户列表.我通过/v1.0/users端点执行此操作.
例如
https://graph.microsoft.com/v1.0/users/
Run Code Online (Sandbox Code Playgroud)
但是,它当前返回在Exchange中设置为资源的会议室的帐户.
我看不到一种简单的方法来检测这些,从而轻松地从我的列表中过滤它们.
有没有人知道我可以过滤什么,或者在对象中查找它是指资源与用户帐户?
我使用V1以获得来自Microsoft REST API的令牌.(我们有Office 365租户,我曾经成功获得所有资源,但没有任何问题.
clientId =8a67......de4b6
clientSecret =J58k8....5EU=
redirectUri =http://example.com...
resourceUrl =https://graph.microsoft.com
authority = https://login.microsoftonline.com/f02633....a603/oauth2/token
Run Code Online (Sandbox Code Playgroud)
https://login.microsoftonline.com/f0263...0be3/oauth2/authorize?client_id=8a6..b6&redirect_uri=http://example.com&response_type=code&scope=mail.read
它给了我一个在JWT上结构如下的令牌.它表示无效签名但不确定是什么问题.
一旦我有了令牌,我就尝试了下面的卷曲调用
curl -i https://graph.microsoft.com/v1.0/me/messages -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Barer eyJ.[TOKEN]...UNa6nfw'
Run Code Online (Sandbox Code Playgroud)
而不是消息,我收到以下错误:
HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8Cl23
Server: Microsoft-IIS/8.5
request-id: af2390b1-a9b...5ab9
client-request-id: af2390,....a615ab9
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceA","ScaleUnit":"000","Host":"AGSFE_IN_4","ADSiteName":"WST"}}
X-Powered-By: ASP.NET
Date: Thu, 19 Jan 2017 23:55:43 GMT
Content-Length: 268
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: -2147184105",
"innerError": {
"request-id": "af2390b1-...5ab9",
"date": "2017-01-19T23:55:44"
}
} …
Run Code Online (Sandbox Code Playgroud) 我正在使用Microsoft Graph查询:"/ v1.0/me/drive/recent".它按预期返回一组文档但是:
超过24小时前,我做了以下事情:
"/v1.0/me/drive/recent"查询多久更新一次?
我正在通过Microsoft Graph从AzureAD请求用户列表。
我得到了User对象,但是它们的MemberOf属性始终为null。
我以为可以使用Expand专门请求该属性,虽然它不会引起错误,但也不会填充该属性。
这从中期-2016答问表明,这种功能在测试版在那个时候,我认为它应该已经毕业了生产API?
var allUsers = await graphClient
.Users
.Request()
.Expand("memberOf")
.GetAsync();
var usersInGroup = allUsers
.Where(user => user.MemberOf.Any(memberOf => memberOf.Id.Equals(groupId, StringComparison.OrdinalIgnoreCase)))
.ToList();
Run Code Online (Sandbox Code Playgroud)
(我尝试扩展“ memberOf”和“ MemberOf”。)
我可以通过网上论坛检索成员列表。
但这返回了ID列表,因此我不得不发出两个请求,而不仅仅是一个。
var groupMembers = await graphClient
.Groups[groupId]
.Members
.Request()
.GetAsync();
var groupMemberIds = groupMembers
.Select(groupMember => groupMember.Id)
.ToList();
var allUsers = await graphClient
.Users
.Request()
.GetAsync();
var usersInGroup = allUsers
.Where(user => groupMemberIds.Contains(user.Id))
.ToList();
Run Code Online (Sandbox Code Playgroud)
如果获取属于该组的ID,然后过滤用户是正确的方法,那很好,我继续。
理想情况下,我想提出一个请求来检索User对象并在服务器端完成过滤。
例如
var usersInGroup = await graphClient
.Users
.Request()
.Filter($"memberOf eq {groupId}")
.GetAsync();
Run Code Online (Sandbox Code Playgroud)
显然,该过滤器将不起作用,但是类似的方法将是理想的。 …
是否有任何微软办公室图形API可用,我可以获得可用和繁忙的会议室详细信息.
我的要求是,我将传递一些开始日期时间和结束日期时间,并期望所有可用和繁忙的房间列表.
至于我知道我们可以添加room outlook门户管理部分.
我通过以下findRoomLists和findrooms API他们只是提供房间信息而不是状态忙/免费.我想要状态也是图API中有任何功能.
https://graph.microsoft.com/beta/me/findRoomLists https://graph.microsoft.com/beta/me/findRooms 已经通过以下链接但没有帮助.
如何使用Microsoft Graph API显示当前可用会议室列表
无法使用Office365 Calendar API获取会议室的所有繁忙时间
谢谢Ajay Tiwari
如何制定/myOrganization/users
包含非英语字符(如日耳曼语变音符号)的Microsoft Graph OData查询?
示例:我的租户中有一位名为"ThomasMüller"的用户.如果我查询
https://graph.microsoft.com/v1.0/myOrganization/users?$filter=startswith(surname,'mu')
我明白了
"value": [
{
"displayName": "Thomas Müller",
"givenName": "Thomas ",
"surname": "Müller"
}
]
// Result truncated for brevity
Run Code Online (Sandbox Code Playgroud)
但如果我搜索
https://graph.microsoft.com/v1.0/myOrganization/users?$filter=startswith(surname,'mü')
我明白了
"value": []
我使用Microsoft Graph API修改位于OneDrive文件夹中的Excel文档.例如,我调用不同的方法来更改文档(创建工作表,修改范围).它的工作时间最长.
但是当我在编辑器(Web版或桌面版)中打开文档时,所有Microsoft Graph方法(POST,PATCH)都开始失败,HTTP:405或"isTrusted":在Graph Explorer中为true.更重要的是它不会总是发生:例如,第一次失败,但如果我关闭文档并再次打开它可以工作,反之亦然.
如果它工作,我在编辑器中看到Guest正在修改文档的工具提示.为什么是客人而不是我(我在同一帐户下的Graph Explorer中进行了身份验证)?
是否有任何技巧或指南如何通过Microsoft Graph在编辑器中修改已打开的Excel文档?
更新(2018年6月22日):不幸的是错误返回.在编辑器中打开文档后,我得到HTTP:405(方法不允许)
因此,我有一个方案,在该方案中,应在特定条件下将用户添加到组中。此外,当应用程序开始运行时,也不应要求用户登录其Microsoft ID / PWD。因此,我访问创建了Graph Service Client对象的令牌,如下所示:
GraphServiceClient graphClient = new GraphServiceClient(
"https://graph.microsoft.com/v1.0",
new DelegateAuthenticationProvider(
async (requestMessage) =>
{
string clientId = "My APP ID";
string authorityFormat = "https://login.microsoftonline.com/{0}/v2.0";
string tenantId = "tenant GUID";
string[] _scopes = new string[] {
"https://graph.microsoft.com/User.ReadBasic.All"
};
// Custom Redirect URI asigned in the Application Registration
// Portal in the native Application Platform
string redirectUri = "https://localhost:4803/";
string clientSecret = "App Secret";
ConfidentialClientApplication daemonClient = new ConfidentialClientApplication(
clientId,
String.Format(authorityFormat, tenantId),
redirectUri,
new ClientCredential(clientSecret),
null, new TokenCache() …
Run Code Online (Sandbox Code Playgroud) /v1.0/me/calendarview?startdatetime=2019-10-07T12:17:48.964Z&enddatetime=2019-10-14T12:17:48.964Z
在Microsoft Graph中调用时,出现以下错误:
{
"error": {
"code": "ErrorApiQuarantined",
"message": "Request has been quarantined by condition.",
"innerError": {
"request-id": "ca5247f8-b461-4270-89e5-186ed6a3b8fe",
"date": "2019-10-07T12:17:49"
}
}
}
Run Code Online (Sandbox Code Playgroud)
致电时,我也会收到相同的错误/v1.0/me/messages
。看来所有Outlook API都不再起作用。