diff --git a/template-bot-master-csharp/DialogMatches.cs b/template-bot-master-csharp/DialogMatches.cs
index a9462d1..1eab410 100644
--- a/template-bot-master-csharp/DialogMatches.cs
+++ b/template-bot-master-csharp/DialogMatches.cs
@@ -56,5 +56,17 @@ public static class DialogMatches
public const string MessageBack = "msgback";
public const string LocalTime = "localtime";
+
+ public const string HeroCard = "hero card";
+ public const string ThumbnailCard = "thumbnail card";
+
+ public const string ConnectorCardV1 = "connectorcardv1";
+ public const string ConnectorCardV2 = "connectorcardv2";
+ public const string ConnectorCardV3 = "connectorcardv3";
+
+ public const string ActionableCard = "actionablecard";
+ public const string ActionableCardV2 = "actionablecardv2";
+
+ public const string PopUpSignIn = "signin";
}
}
\ No newline at end of file
diff --git a/template-bot-master-csharp/Properties/Strings.Designer.cs b/template-bot-master-csharp/Properties/Strings.Designer.cs
index 4d582dd..6d4494a 100644
--- a/template-bot-master-csharp/Properties/Strings.Designer.cs
+++ b/template-bot-master-csharp/Properties/Strings.Designer.cs
@@ -186,6 +186,15 @@ internal static string cmdLocalTime {
}
}
+ ///
+ /// Looks up a localized string similar to msgback.
+ ///
+ internal static string cmdMessageBack {
+ get {
+ return ResourceManager.GetString("cmdMessageBack", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to multi dialog 1.
///
@@ -222,6 +231,15 @@ internal static string cmdO365ConnectorCardActionableMessages {
}
}
+ ///
+ /// Looks up a localized string similar to signin.
+ ///
+ internal static string cmdPopUpSignIn {
+ get {
+ return ResourceManager.GetString("cmdPopUpSignIn", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to prompt.
///
@@ -448,7 +466,7 @@ internal static string DisplayCardErrorMsg {
}
///
- /// Looks up a localized string similar to Hero.
+ /// Looks up a localized string similar to Hero Card.
///
internal static string DisplayCardHeroCard {
get {
@@ -457,7 +475,7 @@ internal static string DisplayCardHeroCard {
}
///
- /// Looks up a localized string similar to Actionable Card.
+ /// Looks up a localized string similar to ActionableCard.
///
internal static string DisplayCardO365ConnectorActionableCard {
get {
@@ -466,7 +484,16 @@ internal static string DisplayCardO365ConnectorActionableCard {
}
///
- /// Looks up a localized string similar to O365ConnectorCard V1.
+ /// Looks up a localized string similar to ActionableCardV2.
+ ///
+ internal static string DisplayCardO365ConnectorActionableCardV2 {
+ get {
+ return ResourceManager.GetString("DisplayCardO365ConnectorActionableCardV2", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to ConnectorCardV1.
///
internal static string DisplayCardO365ConnectorCardV1 {
get {
@@ -475,7 +502,7 @@ internal static string DisplayCardO365ConnectorCardV1 {
}
///
- /// Looks up a localized string similar to O365ConnectorCard V2.
+ /// Looks up a localized string similar to ConnectorCardV2.
///
internal static string DisplayCardO365ConnectorCardV2 {
get {
@@ -484,7 +511,7 @@ internal static string DisplayCardO365ConnectorCardV2 {
}
///
- /// Looks up a localized string similar to O365ConnectorCard V3.
+ /// Looks up a localized string similar to ConnectorCardV3.
///
internal static string DisplayCardO365ConnectorCardV3 {
get {
@@ -520,7 +547,7 @@ internal static string DisplayCardsThanksMsg {
}
///
- /// Looks up a localized string similar to Thumbnail.
+ /// Looks up a localized string similar to Thumbnail Card.
///
internal static string DisplayCardThumbnailCard {
get {
@@ -735,6 +762,15 @@ internal static string HelpCaptionHelloDialog {
}
}
+ ///
+ /// Looks up a localized string similar to Message Back.
+ ///
+ internal static string HelpCaptionMessageBack {
+ get {
+ return ResourceManager.GetString("HelpCaptionMessageBack", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Begin Multi Dailog 1.
///
@@ -762,6 +798,15 @@ internal static string HelpCaptionPlayGame {
}
}
+ ///
+ /// Looks up a localized string similar to Popup Signin.
+ ///
+ internal static string HelpCaptionPopUpSignIn {
+ get {
+ return ResourceManager.GetString("HelpCaptionPopUpSignIn", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Fetch Roster Payload.
///
@@ -879,6 +924,15 @@ internal static string HeroCardTitle {
}
}
+ ///
+ /// Looks up a localized string similar to ActionableMessageCardDialog.
+ ///
+ internal static string LastDialogActionableMessageDialog {
+ get {
+ return ResourceManager.GetString("LastDialogActionableMessageDialog", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to AtMentionDialog.
///
@@ -906,6 +960,33 @@ internal static string LastDialogConnectorCard {
}
}
+ ///
+ /// Looks up a localized string similar to ConnectorCardV1Dialog.
+ ///
+ internal static string LastDialogConnectorCardV1Dialog {
+ get {
+ return ResourceManager.GetString("LastDialogConnectorCardV1Dialog", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to ConnectorCardV2Dialog.
+ ///
+ internal static string LastDialogConnectorCardV2Dialog {
+ get {
+ return ResourceManager.GetString("LastDialogConnectorCardV2Dialog", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to ConnectorCardV3Dialog.
+ ///
+ internal static string LastDialogConnectorCardV3Dialog {
+ get {
+ return ResourceManager.GetString("LastDialogConnectorCardV3Dialog", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to DeepLinkStaticTabDialog.
///
@@ -1041,6 +1122,15 @@ internal static string LastDialogMultiDialog2 {
}
}
+ ///
+ /// Looks up a localized string similar to PopUpSignInDialog.
+ ///
+ internal static string LastDialogPopUpSignIn {
+ get {
+ return ResourceManager.GetString("LastDialogPopUpSignIn", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Last response was from dialog: .
///
@@ -1194,6 +1284,15 @@ internal static string MessageBackPayloadText {
}
}
+ ///
+ /// Looks up a localized string similar to This is Message Back example.
+ ///
+ internal static string MessageBackTitleMsg {
+ get {
+ return ResourceManager.GetString("MessageBackTitleMsg", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Multi Dialog Card Sub Title..
///
@@ -1581,6 +1680,24 @@ internal static string PlayGameWrongChoice {
}
}
+ ///
+ /// Looks up a localized string similar to SignIn.
+ ///
+ internal static string PopUpSignInCardButtonTitle {
+ get {
+ return ResourceManager.GetString("PopUpSignInCardButtonTitle", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Please click below for Popup SignIn experience.
+ ///
+ internal static string PopUpSignInCardTitle {
+ get {
+ return ResourceManager.GetString("PopUpSignInCardTitle", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Ooops, what you choose is not a valid option, please try again!!.
///
@@ -1707,6 +1824,15 @@ internal static string SetUpMsgKey {
}
}
+ ///
+ /// Looks up a localized string similar to MS Teams: Attempted access from a different Office 365 tenant: message rejected.
+ ///
+ internal static string TenantLevelDeniedAccess {
+ get {
+ return ResourceManager.GetString("TenantLevelDeniedAccess", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Thanks for searching the Roster Api..
///
diff --git a/template-bot-master-csharp/Properties/Strings.resx b/template-bot-master-csharp/Properties/Strings.resx
index f7618d8..685adec 100644
--- a/template-bot-master-csharp/Properties/Strings.resx
+++ b/template-bot-master-csharp/Properties/Strings.resx
@@ -397,16 +397,16 @@
no
- Hero
+ Hero Card
- O365ConnectorCard V1
+ ConnectorCardV1
- O365ConnectorCard V2
+ ConnectorCardV2
- O365ConnectorCard V3
+ ConnectorCardV3
What card you would like to test?
@@ -418,7 +418,7 @@
Hope you liked the Cards!!
- Thumbnail
+ Thumbnail Card
Choose Cards
@@ -742,9 +742,51 @@
composeextension/querysettingurl
- Actionable Card
+ ActionableCard
Actionable Card
+
+ ActionableMessageCardDialog
+
+
+ ConnectorCardV1Dialog
+
+
+ ConnectorCardV2Dialog
+
+
+ ConnectorCardV3Dialog
+
+
+ MS Teams: Attempted access from a different Office 365 tenant: message rejected
+
+
+ ActionableCardV2
+
+
+ PopUpSignInDialog
+
+
+ signin
+
+
+ Popup Signin
+
+
+ SignIn
+
+
+ Please click below for Popup SignIn experience
+
+
+ msgback
+
+
+ Message Back
+
+
+ This is Message Back example
+
\ No newline at end of file
diff --git a/template-bot-master-csharp/Web.config b/template-bot-master-csharp/Web.config
index 06f7c58..fb160c1 100644
--- a/template-bot-master-csharp/Web.config
+++ b/template-bot-master-csharp/Web.config
@@ -12,7 +12,8 @@
-
+
+
@@ -36,6 +37,8 @@
+
+
@@ -95,11 +98,11 @@
-
+
-
+
diff --git a/template-bot-master-csharp/middleware/Middleware.cs b/template-bot-master-csharp/middleware/Middleware.cs
new file mode 100644
index 0000000..278a85e
--- /dev/null
+++ b/template-bot-master-csharp/middleware/Middleware.cs
@@ -0,0 +1,25 @@
+using System;
+using Microsoft.Bot.Connector;
+using System.Configuration;
+using Microsoft.Bot.Connector.Teams.Models;
+
+namespace Microsoft.Teams.TemplateBotCSharp.Utility
+{
+ public static class Middleware
+ {
+ public static bool RestrictBotForTenant(IMessageActivity activity)
+ {
+ string targetTenant = ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"] != null ? ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"].ToString() : null;
+ string currentTanent = (activity != null && activity.ChannelData != null && activity.ChannelData["tenant"] != null) ? Convert.ToString(activity.ChannelData["tenant"]["id"]) : null;
+
+ if (string.Equals(targetTenant, currentTanent))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/template-bot-master-csharp/packages.config b/template-bot-master-csharp/packages.config
index c8ddb7e..b42d491 100644
--- a/template-bot-master-csharp/packages.config
+++ b/template-bot-master-csharp/packages.config
@@ -1,12 +1,13 @@
-
+
-
+
+
diff --git a/template-bot-master-csharp/popUpSignin.html b/template-bot-master-csharp/popUpSignin.html
new file mode 100644
index 0000000..08e1449
--- /dev/null
+++ b/template-bot-master-csharp/popUpSignin.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+ User Name :
+
+
+
+
+ Password :
+
+
+
+
+
\ No newline at end of file
diff --git a/template-bot-master-csharp/public/assets/ActionableCardIconImage.png b/template-bot-master-csharp/public/assets/ActionableCardIconImage.png
new file mode 100644
index 0000000..4ca7743
Binary files /dev/null and b/template-bot-master-csharp/public/assets/ActionableCardIconImage.png differ
diff --git a/template-bot-master-csharp/src/controllers/MessagesController.cs b/template-bot-master-csharp/src/controllers/MessagesController.cs
index 0b6b586..b6ed88e 100644
--- a/template-bot-master-csharp/src/controllers/MessagesController.cs
+++ b/template-bot-master-csharp/src/controllers/MessagesController.cs
@@ -28,6 +28,22 @@ public async Task Post([FromBody]Activity activity)
activity.Locale = TemplateUtility.GetLocale(activity);
var messageActivity = StripBotAtMentions.StripAtMentionText(activity);
+
+ //UnComment the below code to restrict the Bot for Specific Tenant
+ //Set the OFFICE_365_TENANT_FILTER key in web.config file with Tenant Information
+
+ //Restrict the bot for specific teams tenant
+ //if(!Middleware.RestrictBotForTenant(activity))
+ //{
+ // var connectorClient = new ConnectorClient(new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/"));
+
+ // Activity replyActivity = activity.CreateReply();
+ // replyActivity.Text = Strings.TenantLevelDeniedAccess;
+
+ // await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
+ // return null;
+ //}
+
try
{
await Conversation.SendAsync(messageActivity, () => new Dialogs.RootDialog());
@@ -57,6 +73,10 @@ public async Task Post([FromBody]Activity activity)
{
messageActivity = ParseInvokeActivityRequest.ParseO365ConnectorCardInvokeRequest(activity);
}
+ else if (activity.Name == "signin/verifyState")
+ {
+ return await PopUpSignInSuccessResponse(activity);
+ }
else
{
messageActivity = ParseInvokeActivityRequest.ParseInvokeRequest(activity);
@@ -296,5 +316,18 @@ private static async Task HandleO365ConnectorCardActionQuer
return new HttpResponseMessage(HttpStatusCode.OK);
}
+
+ private static async Task PopUpSignInSuccessResponse(Activity activity)
+ {
+ var connectorClient = new ConnectorClient(new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/"));
+
+ Activity replyActivity = activity.CreateReply();
+
+ replyActivity.Text = $@"Authentication Successful";
+
+ await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity);
+
+ return new HttpResponseMessage(HttpStatusCode.OK);
+ }
}
}
\ No newline at end of file
diff --git a/template-bot-master-csharp/src/dialogs/RootDialog.cs b/template-bot-master-csharp/src/dialogs/RootDialog.cs
index 87a8699..59ab4f2 100644
--- a/template-bot-master-csharp/src/dialogs/RootDialog.cs
+++ b/template-bot-master-csharp/src/dialogs/RootDialog.cs
@@ -374,5 +374,93 @@ public async Task VSTSAuthGetWorkItemDialog(IDialogContext context, IActivity ac
}
#endregion
+
+ #region Load Hero Card Type
+
+ [RegexPattern(DialogMatches.HeroCard)]
+ [ScorableGroup(1)]
+ public async Task HeroCard(IDialogContext context, IActivity activity)
+ {
+ context.Call(new HeroCardDialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Thumbnail Card Type
+
+ [RegexPattern(DialogMatches.ThumbnailCard)]
+ [ScorableGroup(1)]
+ public async Task ThumbnailCard(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ThumbnailcardDialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Connector Card V1
+
+ [RegexPattern(DialogMatches.ConnectorCardV1)]
+ [ScorableGroup(1)]
+ public async Task O365ConnectorCardV1(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ConnectorCardV1Dialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Connector Card V2
+
+ [RegexPattern(DialogMatches.ConnectorCardV2)]
+ [ScorableGroup(1)]
+ public async Task O365ConnectorCardV2(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ConnectorCardV2Dialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Connector Card V3
+
+ [RegexPattern(DialogMatches.ConnectorCardV3)]
+ [ScorableGroup(1)]
+ public async Task O365ConnectorCardV3(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ConnectorCardV3Dialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Actionable Message Card
+
+ [RegexPattern(DialogMatches.ActionableCard)]
+ [ScorableGroup(1)]
+ public async Task O365ConnectorCardActionableMessage(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ActionableMessageCardDialog(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region Load Actionable Message Card V2
+
+ [RegexPattern(DialogMatches.ActionableCardV2)]
+ [ScorableGroup(1)]
+ public async Task O365ConnectorCardActionableMessageV2(IDialogContext context, IActivity activity)
+ {
+ context.Call(new ActionableMessageCardDialogV2(), this.EndDialog);
+ }
+
+ #endregion
+
+ #region PopUp SignIn
+
+ [RegexPattern(DialogMatches.PopUpSignIn)]
+ [ScorableGroup(1)]
+ public async Task PopUpSignIn(IDialogContext context, IActivity activity)
+ {
+ context.Call(new PopupSigninCardDialog(), this.EndDialog);
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs
similarity index 73%
rename from template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs
rename to template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs
index 7a058de..6f7b5c8 100644
--- a/template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs
+++ b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs
@@ -1,24 +1,22 @@
using Microsoft.Bot.Builder.Dialogs;
-using Microsoft.Bot.Connector;
-using Microsoft.Bot.Connector.Teams.Models;
-using Microsoft.Teams.TemplateBotCSharp.Properties;
-using Microsoft.Teams.TemplateBotCSharp.Utility;
using System;
-using System.Collections.Generic;
using System.Threading.Tasks;
+using Microsoft.Teams.TemplateBotCSharp.Properties;
+using Microsoft.Bot.Connector;
+using System.Collections.Generic;
+using Microsoft.Teams.TemplateBotCSharp.Utility;
+using Microsoft.Bot.Connector.Teams.Models;
namespace Microsoft.Teams.TemplateBotCSharp.Dialogs
{
///
- /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called
- /// and its a Basic example to call Child dialog from Root Dialog.
+ /// This is Actionable Card Dialog Class. Main purpose of this class is to show example of Actionable feature sample like
+ /// MultiChoice, Date, Dropdown and Text
///
[Serializable]
- public class O365ConnectorCardDialog : IDialog