title: how to get chat history from azure table storage
body: <p>Since we are forced to drop the stateclient and move to a custom storage, in my case an <a href="https://github.com/Microsoft/BotBuilder-Azure/tree/master/CSharp/Samples/AzureTable" rel="nofollow noreferrer">azure table storage</a>. Using my storageexplorer I can see that it already saved conversation data on my azure. How can I update my ff code to get past chat history? Before I'm using a IActivityLogger class to log a conversation, but now I'm confused on how to update it.</p>
  
  <p>Global Asax Before:</p>
  
  <pre><code>protected void Application_Start()
  {
      var builder = new ContainerBuilder();
      builder.RegisterType&lt;Logger&gt;().AsImplementedInterfaces().InstancePerDependency();
      builder.Update(Conversation.Container);
      GlobalConfiguration.Configure(WebApiConfig.Register);
  }
  </code></pre>
  
  <p>Global Asax After:</p>
  
  <pre><code>protected void Application_Start()
  {
      Conversation.UpdateContainer(builder =&gt;
      {
          builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
          var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
          builder.Register(c =&gt; store)
          .Keyed&lt;IBotDataStore&lt;BotData&gt;&gt;(AzureModule.Key_DataStore)
          .AsSelf()
          .SingleInstance();
      });
  
      GlobalConfiguration.Configure(WebApiConfig.Register);
  }
  </code></pre>
  
  <p>Logger Class:</p>
  
  <pre><code>public class Logger:IActivityLogger
  {
      public static ConcurrentDictionary&lt;string, List&lt;IActivity&gt;&gt; Messages = new ConcurrentDictionary&lt;string, List&lt;IActivity&gt;&gt;();
  
      public Task LogAsync(IActivity activity)
      {
          try
          {
              var list = new List&lt;IActivity&gt;() { activity };
              Messages.AddOrUpdate(activity.Conversation.Id, list, (k, v) =&gt; { v.Add(activity); return v; });
              return Task.FromResult(false);
          }
          catch (System.Exception)
          {
              throw;
          }
  
      }
  }
  </code></pre>
  
  <p>This is how i use it (how can i update the stateclient part and use my storage on azure?:</p>
  
  <pre><code>var reply = activity.CreateReply();
  var storedActivities = new List&lt;IActivity&gt;();
  var found = Logger.Messages.TryGetValue(activity.Conversation.Id, out storedActivities);
  if (storedActivities != null)
  {
      foreach (var storedActivity in storedActivities)
      {
          reply.Text += $" &lt;br /&gt; &lt;b&gt;{storedActivity.From.Name}:&lt;/b&gt; {storedActivity.AsMessageActivity().Text}";
      }
      // Get any saved values
      StateClient sc = activity.GetStateClient();
      BotData userData = sc.BotState.GetPrivateConversationData(
      activity.ChannelId, activity.Conversation.Id, activity.From.Id);
      var UserEmail = userData.GetProperty&lt;string&gt;("Email");
      var Name = userData.GetProperty&lt;string&gt;("Name");
  }
  </code></pre>
  
  <p>They gave a new tablelogger class. Unfortunately I don't know how to consume it.
  <a href="https://github.com/Microsoft/BotBuilder-Azure/blob/master/CSharp/Library/Microsoft.Bot.Builder.Azure/TableLogger.cs#L60" rel="nofollow noreferrer">TableLogger.cs</a> </p>