title: Update already posted Adaptive Card in Bot Framework v4 in C#
body: <p>I'm working on a Bot with the Bot Framework v4 in C#. What I want now is, that after sending an Adaptive Card to the user, with Actions, that I can update this card after the Action is fired.
  For example, that the button will disappear after the click.</p>
  
  <p><a href="https://stackoverflow.com/questions/55165282/updating-an-activity-in-botframework-v4-on-teams-platform">Link to NodeJS Solution</a></p>
  
  <p>here I have a Solution in NodeJS, but I'm not able to transfer it to C#.
  Can anybody help?</p>
  
  <p>More Project details:
  I have an Adaptive Card that looks like this:
  <a href="https://i.stack.imgur.com/UuKLM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UuKLM.png" alt="enter image description here"></a></p>
  
  <p>This Card will be generated, after I searched with the MS Graph from a SharePoint Library.</p>
  
  <p>The Main Goal is, that i can use the Refiners to update the Card with a new Card from JSON.
  The "OK" button is a Submit Action which can be catched in the OnMessageActivityAsync Method.
  The Input Values are in the Activity Value so can create a Filter Method.
  my Problem is, that I can't update the Card that is already send to the User.</p>
  
  <p>Before I sended the first Card with the Results to the User I write the Activity into a State, so I can Access OnMessageActivityAsync Method, but I'm not sure if this is the right approach.</p>
  
  <pre><code>protected override async Task OnMessageActivityAsync(ITurnContext&lt;IMessageActivity&gt; turnContext, CancellationToken cancellationToken)
      {
          Logger.LogInformation("Running dialog with Message Activity.");
  
          var txt = turnContext.Activity.Text;
          dynamic val = turnContext.Activity.Value;
          // Check if the activity came from a submit action
          if (string.IsNullOrEmpty(txt) &amp;&amp; val != null)
          {
              await turnContext.SendActivityAsync(MessageFactory.Text($"Refiner Language: {val.id_language}"));
              await turnContext.SendActivityAsync(MessageFactory.Text($"Refiner MachType: {val.id_type}"));
  
              var r = new StreamReader("Cards/helloCard2.json");
              string json = r.ReadToEnd();
              AdaptiveCard card = AdaptiveCard.FromJson(json).Card;
  
              var docSearchState = await StateAccessor.GetAsync(turnContext);
              Activity activity = docSearchState.Activity;
              activity.Attachments = new List&lt;Attachment&gt;() {
                  new Attachment()
                  {
                      Name = "Card",
                      ContentType = AdaptiveCard.ContentType,
                      Content = card,
                  }
              };
  
              await turnContext.UpdateActivityAsync(activity);
          }
  </code></pre>
  
  <p>This Code gives me the following Error Message:</p>
  
  <pre><code>fail: Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter[0]
    Exception caught : Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path 'DocumentSearchState.Activity.attachments.$values[0].content.body'.
  </code></pre>
  
  <p>Has anybody a good idea to solve this?</p>