ユーザー アクティビティの取得

名前空間: microsoft.graph

特定のユーザーのアクティビティを取得します。 最近の OData 関数とは異なり、履歴のないアクティビティが返されます。 アクセス許可 UserActivity.ReadWrite.CreatedByApp は応答に追加のフィルター処理を適用し、アプリケーションによって作成されたアクティビティだけが返されます。 このサーバー側のフィルター処理は、ユーザーが特にアクティブで、他のアプリケーションが最近のアクティビティを作成した場合、空のページになる可能性があります。 アプリケーションのアクティビティを取得するには 、nextLink プロパティを使用してページ分割します。

アクセス許可

この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。

アクセス許可の種類 アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校アカウント) UserActivity.ReadWrite.CreatedByApp
委任 (個人用 Microsoft アカウント) UserActivity.ReadWrite.CreatedByApp
アプリケーション サポートされていません。

HTTP 要求

GET /me/activities

オプションのクエリ パラメーター

このメソッドは、 応答のカスタマイズに役立つ OData クエリ パラメーターをサポートします。 次のクエリ パラメーターがサポートされています。

  • $expand historyItems ナビゲーション プロパティの値を 指定します。
  • $topページ間のアイテムの最大数を制限する必要があります。
  • $filter場合は、アクティビティまたは historyItemslastModifiedDateTime プロパティを使用します。

URL エンコードでサポートされるクエリの例を次に示します。

/me/activities?$expand=historyItems($filter=lastModifiedDateTime%20gt%202018-01-22T21:45:00.347Z%20and%20lastModifiedDateTime%20lt%202018-01-22T22:00:00.347Z)

/me/activities?$filter=lastModifiedDateTime%20lt%202018-01-16T01:03:21.347Z%20and%20lastModifiedDateTime%20gt%202018-01-03T01:03:21.347Z

/me/activities?$top=5

要求ヘッダー

名前 説明
Authorization string ベアラー {トークン}。必須。

要求本文

要求本文はありません。

応答

成功した場合、このメソッドは、アプリケーションのユーザーのアクティビティを含む 200 OK 応答コードを返します。

要求

要求の例を次に示します。

GET https://graph.microsoft.com/v1.0/me/activities
応答

応答の例を次に示します。

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(userActivity)",
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/me/activities?$skiptoken=%24filter%3dlastModifiedDateTime+lt+2018-02-26T18%3a06%3a19.365Z",
    "value": [{
        "@odata.type": "#microsoft.graph.userActivity",
        "activitySourceHost": "https://www.contoso.com",
        "createdDateTime": "2018-02-26T18:34:29.592Z",
        "lastModifiedDateTime": "2018-02-26T18:34:29.607Z",
        "id": "5347642601316252694",
        "appActivityId": "/article?12345",
        "visualElements": {
            "attribution": {
              "iconUrl": "https://www.contoso.com/icon",
              "alternateText": "Contoso, Ltd.",
              "addImageQuery": false,
              },
            "displayText": "Contoso How-To: How to Tie a Reef Knot",
            "description": "How to Tie a Reef Knot. A step-by-step visual guide to the art of nautical knot-tying.",
            "backgroundColor": "#ff0000",
            "content": {
              "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
              "type": "AdaptiveCard",
              "body":
              [{
                  "type": "TextBlock",
                  "text": "Contoso MainPage"
              }]
            }
        },
        "activationUrl": "https://www.contoso.com/article?id=12345",
        "appDisplayName": "Contoso, Ltd.",
        "userTimezone": "Africa/Casablanca",
        "fallbackUrl": "https://www.contoso.com/article?id=12345",
        "contentUrl": "https://www.contoso.com/article?id=12345",
        "contentInfo": {
            "@context": "https://schema.org",
            "@type": "Article",
            "author": "John Doe",
            "name": "How to Tie a Reef Knot"
        },
        "expirationDateTime": "2018-03-28T18:34:29.607Z",
        "status": "updated"
    }]
}