I'm trying to send a POST request to the Microsoft Graph API to make a Sharepoint tab. According to the docs, I need to POST an HTTP request to https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/tabs
using this format:
{
"displayName": "SharePoint",
"teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/2a527703-1f6f-4559-a332-d8a7d288cd88"
}
I'm trying to follow what was suggested in another StackOverflow question (How to make HTTP POST web request) using:
public static async Task CreateSharepointTab(string teamsID, string channelId)
{
var responseString = await $"https://graph.microsoft.com/v1.0/teams/{teamsID}/channels/{channelId}/tabs"
.PostUrlEncodedAsync(new { displayName = "Sharepoint tab", teamsApp @odata.bind = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/2a527703-1f6f-4559-a332-d8a7d288cd88" })
.ReceiveString();
}
So teamsApp@odata.bind
as a property name returns an error because of the @
sign. How can I escape it/get around it and properly pass it to my POST request so it's accepted?