-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msgext-search-sso-config-csharp sample (#1045)
* msgext-search-sso-config-csharp sample * build pipeline fixes
- Loading branch information
1 parent
cb31dfc
commit 4f6d8fe
Showing
48 changed files
with
1,910 additions
and
4,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
samples/msgext-search-sso-config/csharp/AdapterWithErrorHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Builder.Integration.AspNet.Core; | ||
using Microsoft.Bot.Builder.TraceExtensions; | ||
using Microsoft.Bot.Connector.Authentication; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.BotBuilderSamples | ||
{ | ||
public class AdapterWithErrorHandler : CloudAdapter | ||
{ | ||
public AdapterWithErrorHandler(BotFrameworkAuthentication auth, ILogger<IBotFrameworkHttpAdapter> logger, ConversationState conversationState = null) | ||
: base(auth, logger) | ||
{ | ||
OnTurnError = async (turnContext, exception) => | ||
{ | ||
// Log any leaked exception from the application. | ||
logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}"); | ||
|
||
// Uncomment below commented line for local debugging. | ||
// await turnContext.SendActivityAsync($"Sorry, it looks like something went wrong. Exception Caught: {exception.Message}"); | ||
|
||
if (conversationState != null) | ||
{ | ||
try | ||
{ | ||
// Delete the conversationState for the current conversation to prevent the | ||
// bot from getting stuck in a error-loop caused by being in a bad state. | ||
// ConversationState should be thought of as similar to "cookie-state" in a Web pages. | ||
await conversationState.DeleteAsync(turnContext); | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.LogError(e, $"Exception caught on attempting to Delete ConversationState : {e.Message}"); | ||
} | ||
} | ||
|
||
// Send a trace activity, which will be displayed in the Bot Framework Emulator | ||
await turnContext.TraceActivityAsync("OnTurnError Trace", exception.Message, "https://www.botframework.com/schemas/error", "TurnError"); | ||
}; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+407 Bytes
samples/msgext-search-sso-config/csharp/AppManifest/icon-outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions
88
samples/msgext-search-sso-config/csharp/AppManifest/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.16/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.16", | ||
"version": "1.0.0", | ||
"id": "${{AAD_APP_CLIENT_ID}}", | ||
"packageName": "com.microsoft.teams.samples.msgExt", | ||
"developer": { | ||
"name": "Microsoft", | ||
"websiteUrl": "https://dev.botframework.com", | ||
"privacyUrl": "https://dev.botframework.com", | ||
"termsOfUseUrl": "https://dev.botframework.com" | ||
}, | ||
"icons": { | ||
"color": "icon-color.png", | ||
"outline": "icon-outline.png" | ||
}, | ||
"name": { | ||
"short": "Messaging Extension SSO", | ||
"full": "ME SSO for Search, Action and link unfurling" | ||
}, | ||
"description": { | ||
"short": "ME Authentication for Search, Action and Link unfurling", | ||
"full": "ME Authentication sample code for all authentication merged" | ||
}, | ||
"accentColor": "#FFFFFF", | ||
"composeExtensions": [ | ||
{ | ||
"botId": "59727dd2-1fae-417c-9035-3abd23172ff3", | ||
"canUpdateConfiguration": true, | ||
"commands": [ | ||
{ | ||
"id": "searchQuery", | ||
"type": "query", | ||
"title": "Search", | ||
"description": "Perform a search", | ||
"initialRun": false, | ||
"fetchTask": false, | ||
"context": [ | ||
"commandBox", | ||
"compose", | ||
"message" | ||
], | ||
"parameters": [ | ||
{ | ||
"name": "searchQuery", | ||
"title": "Search", | ||
"description": "Your search query", | ||
"inputType": "text" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "mailQuery", | ||
"type": "query", | ||
"title": "Mail", | ||
"description": "Perform a mail search", | ||
"initialRun": false, | ||
"fetchTask": false, | ||
"context": [ | ||
"commandBox", | ||
"compose", | ||
"message" | ||
], | ||
"parameters": [ | ||
{ | ||
"name": "mailQuery", | ||
"title": "Mail", | ||
"description": "Perform a mail search", | ||
"inputType": "text" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"permissions": [ | ||
"identity" | ||
], | ||
"validDomains": [ | ||
"*.githubusercontent.com", | ||
"*.botframework.com", | ||
"${{BOT_DOMAIN}}" | ||
], | ||
"webApplicationInfo": { | ||
"id": "${{AAD_APP_CLIENT_ID}}", | ||
"resource": "api://botid-${{AAD_APP_CLIENT_ID}}" | ||
} | ||
} |
Oops, something went wrong.