8

I am trying to use the Microsoft Graph API to create OnlineMeetings here https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=http

But when configuring application access policy as instructed here:

https://learn.microsoft.com/en-us/graph/cloud-communication-online-meeting-application-access-policy

We got a 404 error:

New-CsApplicationAccessPolicy -Identity OnlineMeetings-Link -AppIds "xxx-xxx-xxx" -Description "xxxx Local"      

Get-CsOnlineSession: /Users/xxx/.local/share/powershell/Modules/MicrosoftTeams/2.3.1/netcoreapp3.1/SfBORemotePowershellModule.psm1:63

Line |
  63 |      $remoteSession = & (Get-CsOnlineSessionCommand)
     |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The remote server returned an error: (404) Not Found.

Invoke-Command: /Users/xxx/.local/share/powershell/Modules/MicrosoftTeams/2.3.1/netcoreapp3.1/SfBORemotePowershellModule.psm1:22959

 Line |
22959 |  …    -Session (Get-PSImplicitRemotingSession -CommandName 'New-CsApplic …
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      | Cannot validate argument on parameter 'Session'. The argument
      | is null or empty. Provide an argument that is not null or
      | empty, and then try the command again.

I am an admin of the work/school account, and I have done all setup prerequisites:

https://learn.microsoft.com/en-us/microsoftteams/teams-powershell-install https://learn.microsoft.com/en-us/microsoft-365/enterprise/manage-skype-for-business-online-with-microsoft-365-powershell?view=o365-worldwide

I have all admin permissions to perform PowerShell cmdlet:

Microsoft Permissions

Environment:

PowerShell version: 7.1.3, installed with homebrew
MicrosoftTeams module version: 2.3.1
OS: Mac Mojave 10.14.6

I have no firewall, VPN/proxy enabled. The same issue happens when I tried it in the default PowerShell of Windows 10 VM on VirtualBox.

What should I do to get around this issue?

Hoang Phan
  • 2,146
  • 1
  • 15
  • 16
  • Try [upgrading](https://www.powershellgallery.com/packages/MicrosoftTeams/2.3.2-preview) `MicrosoftTeams module version 2.3.1 to 2.3.2.` – Mr. Panda Jul 14 '21 at 15:49

2 Answers2

2

Upgrade the microsoft teams powershell module to 2.4.0 which is the latest version.

  1. Connect-MicrosoftTeams #Enter global Administrator account credential and make sure that you see Admin account details in connection output.

  2. Now execute the New-CsApplicationAccessPolicy

New-CsApplicationAccessPolicy -Identity OnlineMeetings-Link -AppIds "applicationID" -Description "description here".

enter image description here

enter image description here

To create a online meeting on behalf of a user in Microsoft Teams using Graph API there are two possiblities :

  1. Create an event in teams by doing a Post https://graph.microsoft.com/v1.0/me/events and add properties "isOnlineMeeting":True and "onlineMeetingProvider":"teamsForBusiness" in the Body of the request.

    Sample:

    POST https://graph.microsoft.com/v1.0/me/events
Prefer: outlook.timezone="Pacific Standard Time"
Content-type: application/json

{
  "subject": "Meeting for New Member",
  "body": {
    "contentType": "HTML",
    "content": "Hello Team"
  },
  "start": {
      "dateTime": "2021-07-09T15:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "end": {
      "dateTime": "2021-07-09T15:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "location":{
      "displayName":"Virtual"
  },
  "attendees": [
    {
      "emailAddress": {
        "address":"user@contoso.onmicrosoft.com",
        "name": "User"
      },
      "type": "required"
    }
  ],
  "allowNewTimeProposals": true,
  "isOnlineMeeting": true,
  "onlineMeetingProvider": "teamsForBusiness"
}

If you use the above method then you can invite other users and the meeting appears in the calendar of the organizer.

Reference:

Create Event - Microsoft Graph v1.0 | Microsoft Docs

  1. Create Online Meeting

    You can directly create meeting by doing a post to POST https://graph.microsoft.com/v1.0/me/onlineMeetings

In the above method no invitations are sent and the meeting does not appear in the calendar of the organizer. You would need alternative means to distribute the dial-in link, etc.

Sample:

POST https://graph.microsoft.com/v1.0/me/onlineMeetings
Content-Type: application/json

{
  "startDateTime":"2021-07-09T14:30:34.2444915-05:30",
  "endDateTime":"2021-07-09T15:00:34.2464912-05:30",
  "subject":"User Token Meeting"
}

Reference:

Create onlineMeeting - Microsoft Graph v1.0 | Microsoft Docs

Ansuman Bal
  • 9,705
  • 2
  • 10
  • 27
1

Looking at the error, the following could be the reasons

  • Incorrect App ID or App ID does not exist
  • Session parameter is empty

Request you to please check again and see if it works.

Meghana-MSFT
  • 595
  • 3
  • 7
  • Hi Megana, thanks for your answer. I have checked again and the app ID is correct. Also, the session param empty seems to be the result of the 404 error above, because the guide page on Microsoft doesn't have any command related to the session. – Hoang Phan Jul 12 '21 at 22:41
  • Just have tested a simple command that doesn't have anything related to AppId: `Get-CsOnlineUser` and it still yield the same error (404) for me – Hoang Phan Jul 12 '21 at 23:01
  • @HoangPhan - could you please install [MicrosoftTeams 2.4.0-preview](https://www.powershellgallery.com/packages/MicrosoftTeams/2.4.0-preview) once and see if you are facing same issue? One more check to isolate issue would be to try it with some other [demo tenant](https://learn.microsoft.com/en-us/microsoftteams/platform/get-started/prerequisites?tabs=vscode#get-a-free-teams-developer-tenant-optional), I just tried it on demo tenant and it worked for me. – Wajeed Shaikh Jul 14 '21 at 19:15
  • hi @Wajeed-MSFT, thanks for your suggestion. Just tried using a demo account and it's working. But it doesn't work in my federated account, even though I am a global administrator. I've tried both enabling/disabling 2fa but the issue still persists. The app settings are the same. Do you know what could be the issue in the federated account that could cause this 404 error? – Hoang Phan Aug 09 '21 at 06:38
  • @HoangPhan - Could you please share few error messages using $error[0].exception and $error[1].exception. So that it will be easy for us to investigate the issue. – ChetanSharma-msft Sep 16 '21 at 06:48
  • @HoangPhan - Are you still facing this issue or it is resolved? If issue is still exists, could you please share few error messages using $error[0].exception and $error[1].exception – ChetanSharma-msft Sep 20 '21 at 13:02