Forum Discussion
Fsimoni
May 19, 2023Copper Contributor
How to upload a tiny file on a teams channel using Graph 5 SDK ?
Hello people,
I'm trying to do a simple c#/.net code in order to upload on teams channel, problem is microsoft did new Graph Api version and there is little to no help in order to upload file on this v5 SDK 😞
*I get successfull authentication 😘
var scopes = new[] { "https://graph.microsoft.com/.default" };
// Multi-tenant apps can use "common",
// single-tenant apps must use the tenant ID from the Azure portal
var tenantId = "xxxxxxxxxxxxxxxxxxxxxxx";
// Values from app registration
var clientId = "yyyyyyyyyyyyyyyyyyyyyyyy";
var clientSecret = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
// using Azure.Identity;
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret,options);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
Then i don't know how to do to upload a file.
I saw some old examples with some driveID but methods are not existing anymore on this new SDK...
I have my TeamsID and ChannelID but i don't know how to upload file on it.
Some of you have some inputs please ?
Thanks
No RepliesBe the first to reply