Hi
I am getting error - The type or namespace TwitterCredentials counld not be found. I have installed TweetInviAPI
var userCredentials = new TwitterCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET");
// Upload video to Twitter
var media = Upload.UploadVideo("path_to_video.mp4");
if (media != null)
{
// Post tweet with video
var tweet = Tweetinvi.Tweet.PublishTweet("Check out this video!", new PublishTweetOptionalParameters
{
Medias = { media }
});
}
Thanks
Emily FosterPosted Apr 27, 2025, 7:30 AM
It seems like you are encountering an issue related to the TwitterCredentials class not being found in your project, despite having installed the TweetInviAPI. This kind of error typically occurs when the necessary libraries or namespaces are not being referenced correctly.
To address this problem, first, make sure that you have properly imported the Tweetinvi namespace in your code file. The TwitterCredentials class is usually part of the Tweetinvi library, so confirming that the Tweetinvi namespace is included can help resolve the "TwitterCredentials not found" error.
Here's a quick example of how you can include the necessary namespace at the top of your code file:
By adding this using directive, you are telling your code to look for classes like TwitterCredentials within the Tweetinvi namespace.
Additionally, ensure that the TweetinviAPI package is correctly installed in your project via NuGet or another package manager. This step guarantees that all the required dependencies, including TwitterCredentials, are accessible to your project.
Once you've checked these points, recompile your project to see if the issue is resolved. If the problem persists, verifying your project's references and the version of the TweetinviAPI you have installed may provide further insights into troubleshooting the TwitterCredentials namespace error.
I hope this helps you in resolving the "TwitterCredentials could not be found" error. If you have any more questions or encounter any difficulties, feel free to share more details, and I'll be here to assist further.