Windows 10 Microsoft Graph中的时间线活动
我正在检查Windows10的活动API。我可以将活动插入到图表中,并得到确认,但当我尝试读取活动时,它不在那里。在Windows上,我也没有更改我所期望的内容 我创建了一个应用程序,并使用以下url登录:Windows 10 Microsoft Graph中的时间线活动,windows-10,microsoft-graph-api,Windows 10,Microsoft Graph Api,我正在检查Windows10的活动API。我可以将活动插入到图表中,并得到确认,但当我尝试读取活动时,它不在那里。在Windows上,我也没有更改我所期望的内容 我创建了一个应用程序,并使用以下url登录:https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=MY_ID&scope=openid profile UserActivity.ReadWrite.CreatedByApp&response\u
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=MY_ID&scope=openid profile UserActivity.ReadWrite.CreatedByApp&response\u type=code&redirect\u uri=http://localhost:3000/auth/callback&state=4711
登录后,我获取代码并获取我的承载令牌,如下所示:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
client_id=MY_ID&client_secret=MY_SECRET&grant_type=authorization_code&code=M.R3_BAY.12345678-1234-1234-1234-123456789abc&redirect_uri=http://localhost:3000/auth/callback
PUT https://graph.microsoft.com/v1.0/me/activities/%2Ftest123
Authorization: Bearer MY_BEARER_TOKEN
Content-type: application/json
{
"appActivityId": "/test123",
"activitySourceHost": "https://rks.app",
"userTimezone": "Europe/Berlin",
"appDisplayName": "My Test App",
"activationUrl": "https://rks.app/?active",
"contentUrl": "https://rks.app/?content",
"fallbackUrl": "https://rks.app/?fallback",
"contentInfo": {
"@context": "https://schema.org",
"@type": "Article",
"author": "rekire",
"name": "Testing all the shit"
},
"visualElements": {
"attribution": {
"iconUrl": "https://i.stack.imgur.com/UPzx8.png",
"alternateText": "rekire",
"addImageQuery": false
},
"description": "Description why I am great!",
"backgroundColor": "#ff0000",
"displayText": "Displaying that I am great",
"content": {
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Fancy shit!"
}
]
}
}
}
这正如预期的那样有效。然后我插入如下活动:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
client_id=MY_ID&client_secret=MY_SECRET&grant_type=authorization_code&code=M.R3_BAY.12345678-1234-1234-1234-123456789abc&redirect_uri=http://localhost:3000/auth/callback
PUT https://graph.microsoft.com/v1.0/me/activities/%2Ftest123
Authorization: Bearer MY_BEARER_TOKEN
Content-type: application/json
{
"appActivityId": "/test123",
"activitySourceHost": "https://rks.app",
"userTimezone": "Europe/Berlin",
"appDisplayName": "My Test App",
"activationUrl": "https://rks.app/?active",
"contentUrl": "https://rks.app/?content",
"fallbackUrl": "https://rks.app/?fallback",
"contentInfo": {
"@context": "https://schema.org",
"@type": "Article",
"author": "rekire",
"name": "Testing all the shit"
},
"visualElements": {
"attribution": {
"iconUrl": "https://i.stack.imgur.com/UPzx8.png",
"alternateText": "rekire",
"addImageQuery": false
},
"description": "Description why I am great!",
"backgroundColor": "#ff0000",
"displayText": "Displaying that I am great",
"content": {
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Fancy shit!"
}
]
}
}
}
我的api调用有什么问题吗?当我按Windows+Tab时,我看不到该活动应该在那里,对吗?我发现我没有添加
历史项目
节点。以下是一个示例:
"historyItems": [
{
"userTimezone": "Europe/Berlin",
"startedDateTime": "2020-09-19T16:01:02.123Z",
"lastActiveDateTime": "2020-09-21T08:04:22.123Z"
}
]