microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
567 stars 143 forks source link

Not Getting the "conferenceId" back from the API #1027

Open OrlandoLuque opened 1 year ago

OrlandoLuque commented 1 year ago

I am using PHP Graph.

Following the guidelines at the example 2 of: https://learn.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0&tabs=http.

Query:

array:8 [
  "Subject" => "subject"
  "Body" => array:2 [
    "ContentType" => "text"
    "Content" => "a body"
  ]
  "Start" => array:2 [
    "DateTime" => "2022-10-06T13:25:59"
    "TimeZone" => "Europe/Berlin"
  ]
  "End" => array:2 [
    "DateTime" => "2022-10-06T13:55:59"
    "TimeZone" => "Europe/Berlin"
  ]
  "organizer" => array:1 [
    "emailAddress" => array:2 [
      "name" => "a name"
      "address" => "valid@email.com"
    ]
  ]
  "isOnlineMeeting" => true
  "onlineMeetingProvider" => "teamsForBusiness"
  "attendees" => array:1 [
    0 => array:1 [
      "emailAddress" => array:2 [
        "name" => "a name"
        "address" => "valid@email.com"
      ]
    ]
  ]
]

It works, but I do not receive the conferenceId. "onlineMeeting": { "joinUrl": "https...", }

OrlandoLuque commented 1 year ago

These are the licenses we are using. image

SilasKenneth commented 1 year ago

Hello @OrlandoLuque, Thank you for taking your time to try the SDK and reporting the issue. Sorry for the inconvenience caused. What response do you get when you make the same request on Graph Explorer? Do you get the conferenceId back with Graph Explorer?

OrlandoLuque commented 1 year ago

Thank you!

Using Graph Explorer I find the same problem: no conferenceId is got back: image

(I did not know Graph Explorer, so thank you again :-) )

BTW, I found a user-friendly meeting ID inside the body content, in the format 123 456 789 000, and even 123 456 789 00, but I can not use it with the API AFAIK.

Can I obtain the real ID from maybe the join URL? Or using any other query?

OrlandoLuque commented 1 year ago

well, I am obtaining the id through an extra call:

https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings?$filter=JoinWebUrl eq '{join-url}'

just it works on Graph Explorer, but not on my app, as it appears to be forbidden. I have checked every permission and it should be ok.

Supposed required permissions: image

App permissions: image

And my code to get the access token:

        $guzzle = new \GuzzleHttp\Client();
        $url = 'https://login.microsoftonline.com/' . $tenantId . '/oauth2/token?api-version=1.0';
        $token = json_decode($guzzle->post($url, [
            'form_params' => [
                'client_id' => $clientId,
                'client_secret' => $clientSecret,
                'resource' => 'https://graph.microsoft.com/',
                'grant_type' => 'client_credentials',
                'scopes' => 'openid profile offline_access user.read ' .
                            'mailboxsettings.read calendars.readwrite ' .
                            'onlinemeetings.read onlinemeetings.readall ' .
                            'meetings.readwrite onlinemeetings.readwrite ' .
                            'onlinemeetingartifact.readall group.readwrite '
            ],
        ])->getBody()->getContents());

Received error:

Client error: `GET https://graph.microsoft.com/v1.0/users/{user id}/onlineMeetings?$filter=JoinWebUrl%20eq%20'https://teams.microsoft.com/l/meetup-join/19%3ameeting_{some characters}%40thread.v2/0?context=%7b%22Tid%22%3a%22{another id?}%22%2c%22Oid%22%3a%22{another id?}%22%7d'` resulted in a `403 Forbidden` response:\n{\"error\":{\"code\":\"General\",\"message\":\"No Application Access Policy found for this app.\",\"innerError\":{\"request-id\":\"c2afdedf-f37f-4b01-bd4a-bcb5a645fde2\",\"date\":\"2022-10-18T10:27:22\",\"client-request-id\":\"c2afdedf-f37f-4b01-bd4a-bcb5a645fde2\"}}}\n