-2

I am not sure about the nuget package to be included for the adaptive cards in version 4 bot application which is being migrated from version 3. The options available are AdaptiveCards nuget package and Microsoft.AdaptiveCards(both by Microsoft). In version 3 we had adaptiveCards(by AdaptiveCards) which we were using.

We were using the following nuget package for adaptive cards(by AdaptiveCards) Adaptive cards in our version 3 application, kindly help me with the nuget package to be used for version 4 of same application so that the changes to be done in the existing code could be minimal and time saving.

When I add the suggested package in v4 aplication and the adaptive cards methods, I get the error 'AdaptiveCards is obselete. Please use the overload that accepts the version parameter and specify the version your card requires.'

Nuget Package used

One of the methods from our Adaptive Cards Class:

     //Create an adaptive card to show the SharePoint search result      


       public static Attachment SPSearchAdapativecard(string title, string summery, string actionUrl)
    {
        summery = summery.Replace("<c0>", "**");
        summery = summery.Replace("</c0>", "**");
        summery = summery.Replace("<ddd/>", "...");

        AdaptiveCard card = new AdaptiveCard()
        {
            Body = new List<AdaptiveElement>()
            {

                    new AdaptiveTextBlock()
                    {
                       Text = title,
                       Weight = AdaptiveTextWeight.Bolder,
                       Size = AdaptiveTextSize.Medium,
                       Wrap=false,
                       Separator = false,
                       Color= AdaptiveTextColor.Accent
                    },
                     new AdaptiveTextBlock()
                    {
                       Text = summery,
                       Wrap=true,
                       Size = AdaptiveTextSize.Small
                    },
            },
            Actions = new List<AdaptiveAction>()
            {
                new AdaptiveOpenUrlAction()
                {
                    Id = "moreInfoBtn",
                    Title= "More Info",
                    Url= new Uri(actionUrl)
                }
            }
        };
        // Create the attachment with adapative card.  
        Attachment attachment = new Attachment()
        {
            ContentType = AdaptiveCard.ContentType,
            Content = card
        };
        return attachment;
    }
Tanmayee
  • 57
  • 6
  • I am not sure about the nuget package to be included for the adaptive cards in version 4 bot application which is being migrated from version 3. The options available are AdaptiveCards nuget package and Microsoft.AdaptiveCards(both by Microsoft). In version 3 we had adaptiveCards(by AdaptiveCards) which we were using. – Tanmayee Apr 23 '19 at 05:29
  • it might be a good idea to update your question with the information you just added, and be as clear as possible – TheGeneral Apr 23 '19 at 05:31
  • I have edited my question, it must be fine now. Thanks! – Tanmayee Apr 23 '19 at 05:38

1 Answers1

0

If you look at Microsoft.AdaptiveCards package on Nuget.org (here), you will see that it is old and Deprecated. Last update is 17/09/2017

Then on AdaptiveCards on Nuget: versions are from a few days ago, and initial version is 24/10/2017: this package is the successor of the previously mentioned package.

Moreover, if you look at the Bot Builder Samples on GitHub, there is one for Adaptive Cards here.

Look at the referenced packages:

packages

Nicolas R
  • 13,812
  • 2
  • 28
  • 57
  • Thank you Nicolas. I understand that I will have to use the second one you have mentioned AdaptiveCards - version 1.1.2. Also, please help me with the changes that I will have to implement on the C# code side. – Tanmayee Apr 23 '19 at 10:07
  • It is still the same package. Look at the sample first please, I can’t help more without more context – Nicolas R Apr 23 '19 at 10:21
  • I have edited my question and added a method from our version 3 code. When I add the suggested package in v4 aplication and the adaptive cards methods, I get the error 'AdaptiveCards is obselete. Please use the overload that accepts the version parameter and specify the version your card requires.' – Tanmayee Apr 23 '19 at 12:17
  • So use the overload. It's open-source by the way, so you can directly have a look (even with your error message which can be easily found): https://github.com/Microsoft/AdaptiveCards/blob/master/source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs#L44 – Nicolas R Apr 23 '19 at 12:29
  • yes @Nicolas R, your suggestion of using the overload helped. I am now able to reuse the existing class. Thanks a lot!! – Tanmayee Apr 24 '19 at 08:39