1
Answer

'IUploadClient' does not contain a definition for 'UploadAsync'

Photo of Ramco Ramco

Ramco Ramco

1d
67
1

Hi

      'IUploadClient' does not contain a definition for 'UploadAsync' and no accessible extension method 'UploadAsync' accepting a first argument of type 'IUploadClient' could be found (are you missing a using directive or an assembly reference?)  

public async Task UploadVideoAndTweetAsync(string filePath, string tweetText)
{
    try
    {
        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
        var client = new TwitterClient("JQWrqE", "JTCKUGCB8r", "15MTiR", "64rz");

        byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);

        var uploadResult = await client.Upload.UploadAsync(new ChunkUploadParameters
        {
            MediaFile = filePath,
            MediaType = "video/mp4"
        });


        //Console.WriteLine($"Tweet sent! URL: {tweet.Url}");
    }
    catch (Exception ex)
    {
        Console.WriteLine("Invalid casting. {0}", ex.Message);
    }
}

 

Thanks

Answers (1)