Reputation: 1579
I'm migrating a bot from MS Botframework 3 to 4. We had a function that would email various individuals daily. Moving the code to v4 appears valid, but the call returns an error from inside the framework.
The exception is thrown in the Microsoft.Bot.Connector.Authentication
namespace, in the method MicrosoftAppCredentials(string appId, string password, HttpClient customHttpClient)
. The error is System.ArgumentNullException: 'Value cannot be null. Parameter name: clientId'
. customHttpClient inside that method is null. I do not see a way to pass along an HttpClient. Maybe my implementation is wrong?
My code:
ChannelAccount userAccount = new ChannelAccount(_config.UncategorizedReportToEmail, _config.UncategorizedReportToEmail);
var botAccount = new ChannelAccount(_config.BotEmail, _config.BotEmail);
var connector = new ConnectorClient(new Uri(_config.EmailServiceUrl));
MicrosoftAppCredentials.TrustServiceUrl(_config.EmailServiceUrl);
// Next line is where the exception is thrown
var conversation = connector.Conversations.CreateDirectConversation(botAccount, userAccount);
var conversationId = conversation.Id;
Upvotes: 0
Views: 551
Reputation: 2227
System.ArgumentNullException: 'Value cannot be null. Parameter name: clientId'
This error is a result of appID/password not being read properly from the configuration file. Whether you're using a .bot file, a appsettings.json file, or a web.config file, please make sure your appID and password are correct.
Upvotes: 1