stkhr
stkhr

Reputation: 81

How do I use the conference API in the Teams tab app?

I created a tab app for Teams with reference to this sample.
Github URL : SidePanel Sample

I modified the sample code to receive the response of Teams' conference API as it is, and an error occurred.
The code is deployed in Azure Web Apps.

{
     "code": "MethodNotAllowed",
     "message": "POST is not allowed"
}

I'm told that the POST request isn't allowed, but I don't know where to check or correct it. If you know any reference documents, I would appreciate it if you could let me know.

The modified part is the "After Editing" part below.

HomeController.js

const setContext = (req, res) => {
    const meetingId = req.body.meetingId;
    const userId = req.body.userId;
    const tenantId = req.body.tenantId;
    getRole();
    async function getRole() {
        const token = await credentials.getToken();
        const getRoleRequest = await fetch(`${ sidePanelBot.serviceUrl }/v1/meetings/${ meetingId }/participants/${ userId }?tenantId=${ tenantId }`, {
            method: 'GET',
            headers: {
                'Authorization': 'Bearer ' + token
            }
        });
        const response = await getRoleRequest.json();
        // Before editing
        // const role = response.meeting.role;
        // if (role === 'Organizer') {
        //     res.send(true);
        // } else {
        //     res.send(false);
        // }
        ///////////

        // After editing
        res.send(response);
        ///////////
    }
};

sidePanel.js

$.post({baseURL}+"/api/setContext",{meetingId : meetingId,userId:userId,tenantId:tenantId}).done(function(data)
{
    ///////////
    // Before editing
    // if(data==true)
    ///////////

    // After editing
    const role = data.meeting.role;
    if (role === 'Organizer')
    ///////////
    {
        document.getElementById("agendaButtonDiv").style.display="block";
        document.getElementById("publishAgendaButton").style.display="block";
    }
    else
    {
        document.getElementById("agendaButtonDiv").style.display="none";
        document.getElementById("publishAgendaButton").style.display="none";
    }           
});

Upvotes: 0

Views: 60

Answers (0)

Related Questions