├── .gitignore ├── Deep Dive into Office 365 Connectors.pptx ├── LICENSE ├── README.md ├── SDKs ├── .gitignore ├── LICENSE ├── Office365ConnectorSDK.sln ├── Office365ConnectorSDK │ ├── Fact.cs │ ├── Image.cs │ ├── Message.cs │ ├── Office365ConnectorSDK.csproj │ ├── PotentialAction.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Section.cs │ └── packages.config └── README.md └── Workshop ├── ASP.NET ├── Begin │ ├── BillsListASPNET.Data │ │ ├── BillsListASPNET.Data.sqlproj │ │ ├── Item.sql │ │ ├── Subscription.sql │ │ └── TestDataLoad.sql │ ├── BillsListASPNET.sln │ └── BillsListASPNET │ │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ └── RouteConfig.cs │ │ ├── BillsList.png │ │ ├── BillsListASPNET.csproj │ │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── Controllers │ │ ├── HomeController.cs │ │ └── ItemsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Models │ │ ├── BillsListModel.Context.cs │ │ ├── BillsListModel.Context.tt │ │ ├── BillsListModel.Designer.cs │ │ ├── BillsListModel.cs │ │ ├── BillsListModel.edmx │ │ ├── BillsListModel.edmx.diagram │ │ ├── BillsListModel.tt │ │ ├── Item.cs │ │ └── Subscription.cs │ │ ├── Project_Readme.html │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Items │ │ │ ├── Category.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Detail.cshtml │ │ │ ├── Index.cshtml │ │ │ └── My.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── favicon.ico │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ └── packages.config ├── End-EX3 │ ├── BillsListASPNET.Data │ │ ├── BillsListASPNET.Data.sqlproj │ │ ├── Item.sql │ │ ├── Subscription.sql │ │ └── TestDataLoad.sql │ ├── BillsListASPNET.sln │ └── BillsListASPNET │ │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ └── RouteConfig.cs │ │ ├── BillsList.png │ │ ├── BillsListASPNET.csproj │ │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── Controllers │ │ ├── CallbackController.cs │ │ ├── HomeController.cs │ │ └── ItemsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Models │ │ ├── BillsListModel.Context.cs │ │ ├── BillsListModel.Context.tt │ │ ├── BillsListModel.Designer.cs │ │ ├── BillsListModel.cs │ │ ├── BillsListModel.edmx │ │ ├── BillsListModel.edmx.diagram │ │ ├── BillsListModel.tt │ │ ├── Item.cs │ │ └── Subscription.cs │ │ ├── Project_Readme.html │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Items │ │ │ ├── Category.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Detail.cshtml │ │ │ ├── Index.cshtml │ │ │ └── My.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── favicon.ico │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ └── packages.config ├── End-EX4 │ ├── BillsListASPNET.Data │ │ ├── BillsListASPNET.Data.sqlproj │ │ ├── Item.sql │ │ ├── Subscription.sql │ │ └── TestDataLoad.sql │ ├── BillsListASPNET.sln │ └── BillsListASPNET │ │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ └── RouteConfig.cs │ │ ├── BillsList.png │ │ ├── BillsListASPNET.csproj │ │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── Controllers │ │ ├── CallbackController.cs │ │ ├── HomeController.cs │ │ └── ItemsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── Models │ │ ├── BillsListModel.Context.cs │ │ ├── BillsListModel.Context.tt │ │ ├── BillsListModel.Designer.cs │ │ ├── BillsListModel.cs │ │ ├── BillsListModel.edmx │ │ ├── BillsListModel.edmx.diagram │ │ ├── BillsListModel.tt │ │ ├── Item.cs │ │ └── Subscription.cs │ │ ├── Project_Readme.html │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Callback │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Items │ │ │ ├── Category.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Detail.cshtml │ │ │ ├── Index.cshtml │ │ │ └── My.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── favicon.ico │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ └── packages.config ├── Images │ ├── Mod4_AddGroup.png │ ├── Mod4_CallbackCtrl.png │ ├── Mod4_Card.png │ ├── Mod4_ConnectBtn.png │ ├── Mod4_ConnectMsg.png │ ├── Mod4_ConnectTo.png │ ├── Mod4_ConnectToGroup.png │ ├── Mod4_Connectors.png │ ├── Mod4_ConnectorsAdd.png │ ├── Mod4_ConnectorsForm.png │ ├── Mod4_ConnectorsMenu.png │ ├── Mod4_DbCon2.png │ ├── Mod4_GroupSelect.png │ ├── Mod4_Groups.png │ ├── Mod4_HookDone.png │ ├── Mod4_IncomingConfirmation.png │ ├── Mod4_IncomingWebhook.png │ ├── Mod4_Listings.png │ ├── Mod4_ManualConfirm.png │ ├── Mod4_ManualHook.png │ ├── Mod4_PubDB1.png │ ├── Mod4_SkypeChat.png │ ├── Mod4_Twitter1.png │ ├── Mod4_Twitter2.png │ ├── Mod4_Twitter3.png │ ├── Mod4_presence1.png │ ├── Mod4_presence2.png │ ├── Mod4_signin.png │ └── Mod4_tickets.png └── README.md ├── NodeJS ├── Begin │ ├── .DS_Store │ └── NodeConnectors │ │ ├── .DS_Store │ │ ├── .bowerrc │ │ ├── .gitignore │ │ ├── .vscode │ │ └── launch.json │ │ ├── app.js │ │ ├── authHelper.js │ │ ├── package.json │ │ ├── public │ │ └── stylesheets │ │ │ └── style.css │ │ ├── routes │ │ ├── auth.js │ │ ├── index.js │ │ ├── items.js │ │ └── users.js │ │ ├── typings │ │ └── node │ │ │ └── node.d.ts │ │ └── views │ │ ├── error.hbs │ │ ├── index.hbs │ │ ├── items │ │ ├── category.hbs │ │ ├── create.hbs │ │ ├── detail.hbs │ │ ├── index.hbs │ │ └── my.hbs │ │ └── layout.hbs ├── End-EX3 │ ├── .DS_Store │ └── NodeConnectors │ │ ├── .DS_Store │ │ ├── .bowerrc │ │ ├── .gitignore │ │ ├── .vscode │ │ └── launch.json │ │ ├── app.js │ │ ├── authHelper.js │ │ ├── package.json │ │ ├── public │ │ └── stylesheets │ │ │ └── style.css │ │ ├── routes │ │ ├── auth.js │ │ ├── callback.js │ │ ├── error.js │ │ ├── index.js │ │ ├── items.js │ │ └── users.js │ │ ├── typings │ │ └── node │ │ │ └── node.d.ts │ │ └── views │ │ ├── error.hbs │ │ ├── index.hbs │ │ ├── items │ │ ├── category.hbs │ │ ├── create.hbs │ │ ├── detail.hbs │ │ ├── index.hbs │ │ └── my.hbs │ │ └── layout.hbs ├── End-EX4 │ ├── .DS_Store │ └── NodeConnectors │ │ ├── .DS_Store │ │ ├── .bowerrc │ │ ├── .gitignore │ │ ├── .vscode │ │ └── launch.json │ │ ├── app.js │ │ ├── authHelper.js │ │ ├── package.json │ │ ├── public │ │ └── stylesheets │ │ │ └── style.css │ │ ├── routes │ │ ├── auth.js │ │ ├── callback.js │ │ ├── error.js │ │ ├── index.js │ │ ├── items.js │ │ └── users.js │ │ ├── typings │ │ └── node │ │ │ └── node.d.ts │ │ └── views │ │ ├── callback │ │ └── index.hbs │ │ ├── error.hbs │ │ ├── index.hbs │ │ ├── items │ │ ├── category.hbs │ │ ├── create.hbs │ │ ├── detail.hbs │ │ ├── index.hbs │ │ └── my.hbs │ │ └── layout.hbs ├── Images │ ├── Mod4_AddGroup.png │ ├── Mod4_CallbackCtrl.png │ ├── Mod4_Card.png │ ├── Mod4_ConnectBtn.png │ ├── Mod4_ConnectMsg.png │ ├── Mod4_ConnectTo.png │ ├── Mod4_ConnectToGroup.png │ ├── Mod4_Connectors.png │ ├── Mod4_ConnectorsAdd.png │ ├── Mod4_ConnectorsForm.png │ ├── Mod4_ConnectorsMenu.png │ ├── Mod4_DbCon2.png │ ├── Mod4_GroupSelect.png │ ├── Mod4_Groups.png │ ├── Mod4_HookDone.png │ ├── Mod4_IncomingConfirmation.png │ ├── Mod4_IncomingWebhook.png │ ├── Mod4_Listings.png │ ├── Mod4_ManualConfirm.png │ ├── Mod4_ManualHook.png │ ├── Mod4_PubDB1.png │ ├── Mod4_SkypeChat.png │ ├── Mod4_Twitter1.png │ ├── Mod4_Twitter2.png │ ├── Mod4_Twitter3.png │ ├── Mod4_presence1.png │ ├── Mod4_presence2.png │ ├── Mod4_signin.png │ └── Mod4_tickets.png └── README.md └── README.md /Deep Dive into Office 365 Connectors.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Deep Dive into Office 365 Connectors.pptx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Office Developer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SDKs/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Richard diZerega 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Office365ConnectorSDK", "Office365ConnectorSDK\Office365ConnectorSDK.csproj", "{E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Fact.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Office365ConnectorSDK 8 | { 9 | public class Fact 10 | { 11 | public Fact() { } 12 | public Fact(string name, string value) 13 | { 14 | this.name = name; 15 | this.value = value; 16 | } 17 | public string name { get; set; } 18 | public string value { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Image.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Office365ConnectorSDK 8 | { 9 | public class Image 10 | { 11 | public Image() { } 12 | public Image(string image) { this.image = image; } 13 | public Image(string image, string title) { this.image = image; this.title = title; } 14 | public string title { get; set; } 15 | public string image { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Message.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Net.Http.Headers; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Office365ConnectorSDK 11 | { 12 | public class Message 13 | { 14 | public string summary { get; set; } 15 | public string text { get; set; } 16 | public string title { get; set; } 17 | public string themeColor { get; set; } 18 | public List
sections { get; set; } 19 | public List potentialAction { get; set; } 20 | 21 | public string ToJson() 22 | { 23 | return JsonConvert.SerializeObject(this, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); 24 | } 25 | public async Task Send(string webhook_uri) 26 | { 27 | HttpClient client = new HttpClient(); 28 | client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 29 | var content = new StringContent(this.ToJson(), System.Text.Encoding.UTF8, "application/json"); 30 | using (var response = await client.PostAsync(webhook_uri, content)) 31 | { 32 | return response.IsSuccessStatusCode; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Office365ConnectorSDK.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E9D5D72D-AFD7-4D39-8E46-4AC7973CC1FE} 8 | Library 9 | Properties 10 | Office365ConnectorSDK 11 | Office365ConnectorSDK 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll 35 | True 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 65 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/PotentialAction.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Office365ConnectorSDK 9 | { 10 | public class PotentialAction 11 | { 12 | public PotentialAction() 13 | { 14 | context = "http://schema.org"; 15 | type = "ViewAction"; 16 | } 17 | [JsonProperty(PropertyName = "@context")] 18 | public string context { get; set; } 19 | [JsonProperty(PropertyName = "@type")] 20 | public string type { get; set; } 21 | public string name { get; set; } 22 | public List target { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Office365ConnectorSDK")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Office365ConnectorSDK")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e9d5d72d-afd7-4d39-8e46-4ac7973cc1fe")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/Section.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Office365ConnectorSDK 8 | { 9 | public class Section 10 | { 11 | public string title { get; set; } 12 | public string activityTitle { get; set; } 13 | public string activitySubtitle { get; set; } 14 | public string activityImage { get; set; } 15 | public string activityText { get; set; } 16 | public List facts { get; set; } 17 | public List images { get; set; } 18 | public string text { get; set; } 19 | public bool? markdown { get; set; } 20 | public List potentialAction { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SDKs/Office365ConnectorSDK/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET.Data/Item.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Item] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [Title] NVARCHAR(100) NOT NULL, 5 | [Price] DECIMAL(18, 2) NULL, 6 | [Body] NVARCHAR(MAX) NULL, 7 | [Category] NVARCHAR(50) NOT NULL, 8 | [Owner] NVARCHAR(100) NOT NULL, 9 | [PostDate] DATETIME NOT NULL, 10 | [Location] NVARCHAR(100) NOT NULL, 11 | [Image] NVARCHAR(MAX) NULL 12 | ) 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET.Data/Subscription.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Subscription] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [GroupName] NVARCHAR(100) NOT NULL, 5 | [WebHookUri] NVARCHAR(MAX) NOT NULL, 6 | [Category] NVARCHAR(50) NULL 7 | ) 8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BillsListASPNET", "BillsListASPNET\BillsListASPNET.csproj", "{8B63B17F-40EA-4D69-80B8-202DB7603F8F}" 7 | EndProject 8 | Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "BillsListASPNET.Data", "BillsListASPNET.Data\BillsListASPNET.Data.sqlproj", "{969CB91E-C5F5-4BEB-9418-80594B450B36}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 23 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Deploy.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace BillsListASPNET 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/BillsList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/BillsList.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | .card { 20 | margin-top: 10px; 21 | margin-bottom: 10px; 22 | border: 1px solid #ccc; 23 | border-radius: 5px; 24 | } 25 | 26 | .price { 27 | background-color: #fff; 28 | padding: 2px; 29 | border-radius: 3px 4px; 30 | border: 1px solid #ccc; 31 | } 32 | 33 | .price.abs { 34 | position: absolute; 35 | background-color: #fff; 36 | padding: 4px; 37 | border-radius: 5px 0px; 38 | border: 1px solid #ccc; 39 | z-index: 2000; 40 | } 41 | 42 | .img { 43 | width: 100%; 44 | height: calc(width * .7); 45 | overflow: hidden; 46 | } 47 | 48 | .details { 49 | padding: 5px; 50 | height: 70px; 51 | max-height: 70px; 52 | overflow: hidden; 53 | } 54 | 55 | .ratio { 56 | position:relative; 57 | width: 100%; 58 | height: 0; 59 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 60 | 61 | background-repeat: no-repeat; 62 | background-position: center center; 63 | background-size: cover; 64 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace BillsListASPNET.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="BillsListASPNET.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace BillsListASPNET 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/BillsListModel.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | public partial class BillsListEntities : DbContext 17 | { 18 | public BillsListEntities() 19 | : base("name=BillsListEntities") 20 | { 21 | } 22 | 23 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 24 | { 25 | throw new UnintentionalCodeFirstException(); 26 | } 27 | 28 | public DbSet Items { get; set; } 29 | public DbSet Subscriptions { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/BillsListModel.Designer.cs: -------------------------------------------------------------------------------- 1 | // T4 code generation is enabled for model 'C:\CodeLabs\Workshops\Office\Module4-O365ConnectorsAndSkype\Source\Ex1\Begin\BillsListASPNET\Models\BillsListModel.edmx'. 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model 4 | // is open in the designer. 5 | 6 | // If no context and entity classes have been generated, it may be because you created an empty model but 7 | // have not yet chosen which version of Entity Framework to use. To generate a context class and entity 8 | // classes for your model, open the model in the designer, right-click on the designer surface, and 9 | // select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation 10 | // Item...'. -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/BillsListModel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/BillsListModel.edmx.diagram: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/Item.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Item 16 | { 17 | public int Id { get; set; } 18 | public string Title { get; set; } 19 | public Nullable Price { get; set; } 20 | public string Body { get; set; } 21 | public string Category { get; set; } 22 | public string Owner { get; set; } 23 | public System.DateTime PostDate { get; set; } 24 | public string Location { get; set; } 25 | public string Image { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Models/Subscription.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Subscription 16 | { 17 | public int Id { get; set; } 18 | public string GroupName { get; set; } 19 | public string WebHookUri { get; set; } 20 | public string Category { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BillsListASPNET")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BillsListASPNET")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d34847c0-0e2b-46e4-88f4-4aade23516c8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/Scripts/_references.js -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Owin; 5 | using Microsoft.IdentityModel.Protocols; 6 | using Microsoft.Owin.Security.Cookies; 7 | using Microsoft.Owin.Security.OpenIdConnect; 8 | using Microsoft.Owin.Security; 9 | using System.Globalization; 10 | using System.IdentityModel.Tokens; 11 | using System.Configuration; 12 | 13 | [assembly: OwinStartup(typeof(BillsListASPNET.Startup))] 14 | 15 | namespace BillsListASPNET 16 | { 17 | public class Startup 18 | { 19 | public static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; 20 | public static string clientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"]; 21 | public static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; 22 | public static string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"]; 23 | 24 | public void Configuration(IAppBuilder app) 25 | { 26 | app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 27 | 28 | app.UseCookieAuthentication(new CookieAuthenticationOptions()); 29 | 30 | app.UseOpenIdConnectAuthentication( 31 | new OpenIdConnectAuthenticationOptions 32 | { 33 | ClientId = clientId, 34 | Authority = String.Format(CultureInfo.InvariantCulture, aadInstance, "common", "/v2.0"), 35 | RedirectUri = redirectUri, 36 | Scope = "openid email profile", 37 | ResponseType = "id_token", 38 | PostLogoutRedirectUri = redirectUri, 39 | TokenValidationParameters = new TokenValidationParameters 40 | { 41 | ValidateIssuer = false, 42 | }, 43 | Notifications = new OpenIdConnectAuthenticationNotifications 44 | { 45 | AuthenticationFailed = (context) => 46 | { 47 | context.HandleResponse(); 48 | context.Response.Redirect("/Error?message=" + context.Exception.Message); 49 | return Task.FromResult(0); 50 | } 51 | } 52 | }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

BillsList

7 |

BillsList is a free online classified advertisement site.

8 |

Learn more »

9 |
10 | 11 |
12 |
13 |

Getting started

14 |

View the latest sale listing across the entire site or by categories.

15 |

View listings »

16 |
17 |
18 |

Create a listing

19 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

20 |

Create listing »

21 |
22 |
23 |

My listings

24 |

Already have an active listing? View all of your listing using the my listings button below.

25 |

My listings »

26 |
27 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Items/Category.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Category"; 4 | } 5 | @model List 6 | 7 |

for sale > @ViewData["category"]

8 |
9 | @foreach (var item in Model) 10 | { 11 |
12 |
13 | @item.Price 14 |
15 | 16 |
17 |
18 |
19 |
20 | @item.Title 21 |
22 |
23 |
24 | } 25 |
26 | 27 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Items/Create.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Create"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

Create

8 | @using (Html.BeginForm("create", "items", FormMethod.Post, new { enctype = "multipart/form-data" })) 9 | { 10 |
11 |
12 | 13 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 14 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 15 |
16 |
17 |
18 |
19 | 20 |
21 |
$
22 | @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } }) 23 |
24 | @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" }) 25 |
26 |
27 |
28 |
29 | 30 | @Html.EditorFor(model => model.Location, new { htmlAttributes = new { @class = "form-control" } }) 31 | @Html.ValidationMessageFor(model => model.Location, "", new { @class = "text-danger" }) 32 |
33 |
34 |
35 |
36 | 37 | @Html.DropDownListFor(model => model.Category, new SelectList((List)ViewData["categories"]), new { @class = "form-control" }) 38 | @Html.ValidationMessageFor(model => model.Category, "", new { @class = "text-danger" }) 39 |
40 |
41 |
42 |
43 | 44 | @Html.TextAreaFor(model => model.Body, new { cols = 35, @rows = 3, @class = "form-control" }) 45 | @Html.ValidationMessageFor(model => model.Body, "", new { @class = "text-danger" }) 46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 | 55 |
56 | 57 | @Html.ActionLink("Cancel", "My", new object() { }, new { @class = "btn btn-default" }) 58 |
59 | } 60 | 61 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Items/Detail.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Detail"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

for sale > @Model.Title - @Model.Price (@Model.Location)

8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |
16 |

@Model.Body

17 |
18 |
19 |

Contact Seller

20 |
21 | 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Items/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Index"; 4 | } 5 | @model List 6 | 7 |

for sale

8 |
9 | @foreach (var item in Model) 10 | { 11 |
12 |
13 | @item.Price 14 |
15 | 16 |
17 |
18 |
19 |
20 | @item.Title - @item.Category 21 |
22 |
23 |
24 | } 25 |
26 | 27 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Items/My.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "My"; 4 | } 5 | @model List 6 | 7 |

for sale > me

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | @foreach (var item in Model) 20 | { 21 | 22 | 23 | 24 | 25 | 26 | 27 | } 28 | 29 |
TitleCategoryPrice
(@Html.ActionLink("Delete", "Delete", new { id = item.Id }))@item.Title@item.Category@item.Price
30 |
31 |
32 | @Html.ActionLink("Create Listing", "Create", new object() { }, new { @class = "btn btn-default" }) 33 |
34 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 31 |
32 | @RenderBody() 33 |
34 | 35 | @Scripts.Render("~/bundles/jquery") 36 | @Scripts.Render("~/bundles/bootstrap") 37 | @RenderSection("scripts", required: false) 38 | 39 | 40 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/favicon.ico -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Begin/BillsListASPNET/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Workshop/ASP.NET/Begin/BillsListASPNET/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET.Data/Item.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Item] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [Title] NVARCHAR(100) NOT NULL, 5 | [Price] DECIMAL(18, 2) NULL, 6 | [Body] NVARCHAR(MAX) NULL, 7 | [Category] NVARCHAR(50) NOT NULL, 8 | [Owner] NVARCHAR(100) NOT NULL, 9 | [PostDate] DATETIME NOT NULL, 10 | [Location] NVARCHAR(100) NOT NULL, 11 | [Image] NVARCHAR(MAX) NULL 12 | ) 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET.Data/Subscription.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Subscription] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [GroupName] NVARCHAR(100) NOT NULL, 5 | [WebHookUri] NVARCHAR(MAX) NOT NULL, 6 | [Category] NVARCHAR(50) NULL 7 | ) 8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BillsListASPNET", "BillsListASPNET\BillsListASPNET.csproj", "{8B63B17F-40EA-4D69-80B8-202DB7603F8F}" 7 | EndProject 8 | Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "BillsListASPNET.Data", "BillsListASPNET.Data\BillsListASPNET.Data.sqlproj", "{969CB91E-C5F5-4BEB-9418-80594B450B36}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 23 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Deploy.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace BillsListASPNET 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/BillsList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/BillsList.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | .card { 20 | margin-top: 10px; 21 | margin-bottom: 10px; 22 | border: 1px solid #ccc; 23 | border-radius: 5px; 24 | } 25 | 26 | .price { 27 | background-color: #fff; 28 | padding: 2px; 29 | border-radius: 3px 4px; 30 | border: 1px solid #ccc; 31 | } 32 | 33 | .price.abs { 34 | position: absolute; 35 | background-color: #fff; 36 | padding: 4px; 37 | border-radius: 5px 0px; 38 | border: 1px solid #ccc; 39 | z-index: 2000; 40 | } 41 | 42 | .img { 43 | width: 100%; 44 | height: calc(width * .7); 45 | overflow: hidden; 46 | } 47 | 48 | .details { 49 | padding: 5px; 50 | height: 70px; 51 | max-height: 70px; 52 | overflow: hidden; 53 | } 54 | 55 | .ratio { 56 | position:relative; 57 | width: 100%; 58 | height: 0; 59 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 60 | 61 | background-repeat: no-repeat; 62 | background-position: center center; 63 | background-size: cover; 64 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Controllers/CallbackController.cs: -------------------------------------------------------------------------------- 1 | using BillsListASPNET.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | 8 | namespace BillsListASPNET.Controllers 9 | { 10 | public class CallbackController : Controller 11 | { 12 | // GET: Callback 13 | public ActionResult Index() 14 | { 15 | var error = Request["error"]; 16 | var state = Request["state"]; 17 | if (!String.IsNullOrEmpty(error)) 18 | { 19 | return RedirectToAction("Error", "Home", null); 20 | } 21 | else 22 | { 23 | var group = Request["group_name"]; 24 | var webhook = Request["webhook_url"]; 25 | Subscription sub = new Subscription(); 26 | sub.GroupName = group; 27 | sub.WebHookUri = webhook; 28 | 29 | //save the subscription 30 | using (BillsListEntities entities = new BillsListEntities()) 31 | { 32 | entities.Subscriptions.Add(sub); 33 | entities.SaveChanges(); 34 | return Redirect(state); 35 | } 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace BillsListASPNET.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="BillsListASPNET.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace BillsListASPNET 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/BillsListModel.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | public partial class BillsListEntities : DbContext 17 | { 18 | public BillsListEntities() 19 | : base("name=BillsListEntities") 20 | { 21 | } 22 | 23 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 24 | { 25 | throw new UnintentionalCodeFirstException(); 26 | } 27 | 28 | public DbSet Items { get; set; } 29 | public DbSet Subscriptions { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/BillsListModel.Designer.cs: -------------------------------------------------------------------------------- 1 | // T4 code generation is enabled for model 'C:\Projects\Delete\BillsListASPNET\BillsListASPNET\Models\BillsListModel.edmx'. 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model 4 | // is open in the designer. 5 | 6 | // If no context and entity classes have been generated, it may be because you created an empty model but 7 | // have not yet chosen which version of Entity Framework to use. To generate a context class and entity 8 | // classes for your model, open the model in the designer, right-click on the designer surface, and 9 | // select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation 10 | // Item...'. -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/BillsListModel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/BillsListModel.edmx.diagram: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/Item.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Item 16 | { 17 | public int Id { get; set; } 18 | public string Title { get; set; } 19 | public Nullable Price { get; set; } 20 | public string Body { get; set; } 21 | public string Category { get; set; } 22 | public string Owner { get; set; } 23 | public System.DateTime PostDate { get; set; } 24 | public string Location { get; set; } 25 | public string Image { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Models/Subscription.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Subscription 16 | { 17 | public int Id { get; set; } 18 | public string GroupName { get; set; } 19 | public string WebHookUri { get; set; } 20 | public string Category { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BillsListASPNET")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BillsListASPNET")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d34847c0-0e2b-46e4-88f4-4aade23516c8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/Scripts/_references.js -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Owin; 5 | using Microsoft.IdentityModel.Protocols; 6 | using Microsoft.Owin.Security.Cookies; 7 | using Microsoft.Owin.Security.OpenIdConnect; 8 | using Microsoft.Owin.Security; 9 | using System.Globalization; 10 | using System.IdentityModel.Tokens; 11 | using System.Configuration; 12 | 13 | [assembly: OwinStartup(typeof(BillsListASPNET.Startup))] 14 | 15 | namespace BillsListASPNET 16 | { 17 | public class Startup 18 | { 19 | public static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; 20 | public static string clientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"]; 21 | public static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; 22 | public static string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"]; 23 | 24 | public void Configuration(IAppBuilder app) 25 | { 26 | app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 27 | 28 | app.UseCookieAuthentication(new CookieAuthenticationOptions()); 29 | 30 | app.UseOpenIdConnectAuthentication( 31 | new OpenIdConnectAuthenticationOptions 32 | { 33 | ClientId = clientId, 34 | Authority = String.Format(CultureInfo.InvariantCulture, aadInstance, "common", "/v2.0"), 35 | RedirectUri = redirectUri, 36 | Scope = "openid email profile", 37 | ResponseType = "id_token", 38 | PostLogoutRedirectUri = redirectUri, 39 | TokenValidationParameters = new TokenValidationParameters 40 | { 41 | ValidateIssuer = false, 42 | }, 43 | Notifications = new OpenIdConnectAuthenticationNotifications 44 | { 45 | AuthenticationFailed = (context) => 46 | { 47 | context.HandleResponse(); 48 | context.Response.Redirect("/Error?message=" + context.Exception.Message); 49 | return Task.FromResult(0); 50 | } 51 | } 52 | }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

BillsList

7 |

BillsList is a free online classified advertisement site.

8 |

Learn more »

9 |
10 | 11 |
12 |
13 |

Getting started

14 |

View the latest sale listing across the entire site or by categories.

15 |

View listings »

16 |
17 |
18 |

Create a listing

19 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

20 |

Create listing »

21 |
22 |
23 |

My listings

24 |

Already have an active listing? View all of your listing using the my listings button below.

25 |

My listings »

26 |
27 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Items/Category.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Category"; 4 | } 5 | @model List 6 | 7 |

8 | for sale > @ViewData["category"] 9 |

10 |
11 | @foreach (var item in Model) 12 | { 13 |
14 |
15 | @item.Price 16 |
17 | 18 |
19 |
20 |
21 |
22 | @item.Title 23 |
24 |
25 |
26 | } 27 |
28 | 29 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Items/Create.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Create"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

Create

8 | @using (Html.BeginForm("create", "items", FormMethod.Post, new { enctype = "multipart/form-data" })) 9 | { 10 |
11 |
12 | 13 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 14 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 15 |
16 |
17 |
18 |
19 | 20 |
21 |
$
22 | @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } }) 23 |
24 | @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" }) 25 |
26 |
27 |
28 |
29 | 30 | @Html.EditorFor(model => model.Location, new { htmlAttributes = new { @class = "form-control" } }) 31 | @Html.ValidationMessageFor(model => model.Location, "", new { @class = "text-danger" }) 32 |
33 |
34 |
35 |
36 | 37 | @Html.DropDownListFor(model => model.Category, new SelectList((List)ViewData["categories"]), new { @class = "form-control" }) 38 | @Html.ValidationMessageFor(model => model.Category, "", new { @class = "text-danger" }) 39 |
40 |
41 |
42 |
43 | 44 | @Html.TextAreaFor(model => model.Body, new { cols = 35, @rows = 3, @class = "form-control" }) 45 | @Html.ValidationMessageFor(model => model.Body, "", new { @class = "text-danger" }) 46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 | 55 |
56 | 57 | @Html.ActionLink("Cancel", "My", new object() { }, new { @class = "btn btn-default" }) 58 |
59 | } 60 | 61 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Items/Detail.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Detail"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

for sale > @Model.Title - @Model.Price (@Model.Location)

8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |
16 |

@Model.Body

17 |
18 |
19 |

Contact Seller

20 |
21 | 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Items/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Index"; 4 | } 5 | @model List 6 | 7 |

8 | for sale 9 |

10 |
11 | @foreach (var item in Model) 12 | { 13 |
14 |
15 | @item.Price 16 |
17 | 18 |
19 |
20 |
21 |
22 | @item.Title - @item.Category 23 |
24 |
25 |
26 | } 27 |
28 | 29 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Items/My.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "My"; 4 | } 5 | @model List 6 | 7 |

for sale > me

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | @foreach (var item in Model) 20 | { 21 | 22 | 23 | 24 | 25 | 26 | 27 | } 28 | 29 |
TitleCategoryPrice
(@Html.ActionLink("Delete", "Delete", new { id = item.Id }))@item.Title@item.Category@item.Price
30 |
31 |
32 | @Html.ActionLink("Create Listing", "Create", new object() { }, new { @class = "btn btn-default" }) 33 |
34 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 38 |
39 | @RenderBody() 40 |
41 | 42 | @Scripts.Render("~/bundles/jquery") 43 | @Scripts.Render("~/bundles/bootstrap") 44 | @RenderSection("scripts", required: false) 45 | 46 | 47 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/favicon.ico -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX3/BillsListASPNET/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX3/BillsListASPNET/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET.Data/Item.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Item] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [Title] NVARCHAR(100) NOT NULL, 5 | [Price] DECIMAL(18, 2) NULL, 6 | [Body] NVARCHAR(MAX) NULL, 7 | [Category] NVARCHAR(50) NOT NULL, 8 | [Owner] NVARCHAR(100) NOT NULL, 9 | [PostDate] DATETIME NOT NULL, 10 | [Location] NVARCHAR(100) NOT NULL, 11 | [Image] NVARCHAR(MAX) NULL 12 | ) 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET.Data/Subscription.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Subscription] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [GroupName] NVARCHAR(100) NOT NULL, 5 | [WebHookUri] NVARCHAR(MAX) NOT NULL, 6 | [Category] NVARCHAR(50) NULL 7 | ) 8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BillsListASPNET", "BillsListASPNET\BillsListASPNET.csproj", "{8B63B17F-40EA-4D69-80B8-202DB7603F8F}" 7 | EndProject 8 | Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "BillsListASPNET.Data", "BillsListASPNET.Data\BillsListASPNET.Data.sqlproj", "{969CB91E-C5F5-4BEB-9418-80594B450B36}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {8B63B17F-40EA-4D69-80B8-202DB7603F8F}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 23 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {969CB91E-C5F5-4BEB-9418-80594B450B36}.Release|Any CPU.Deploy.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace BillsListASPNET 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace BillsListASPNET 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/BillsList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/BillsList.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | .card { 20 | margin-top: 10px; 21 | margin-bottom: 10px; 22 | border: 1px solid #ccc; 23 | border-radius: 5px; 24 | } 25 | 26 | .price { 27 | background-color: #fff; 28 | padding: 2px; 29 | border-radius: 3px 4px; 30 | border: 1px solid #ccc; 31 | } 32 | 33 | .price.abs { 34 | position: absolute; 35 | background-color: #fff; 36 | padding: 4px; 37 | border-radius: 5px 0px; 38 | border: 1px solid #ccc; 39 | z-index: 2000; 40 | } 41 | 42 | .img { 43 | width: 100%; 44 | height: calc(width * .7); 45 | overflow: hidden; 46 | } 47 | 48 | .details { 49 | padding: 5px; 50 | height: 70px; 51 | max-height: 70px; 52 | overflow: hidden; 53 | } 54 | 55 | .ratio { 56 | position:relative; 57 | width: 100%; 58 | height: 0; 59 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 60 | 61 | background-repeat: no-repeat; 62 | background-position: center center; 63 | background-size: cover; 64 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Controllers/CallbackController.cs: -------------------------------------------------------------------------------- 1 | using BillsListASPNET.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Web; 7 | using System.Web.Mvc; 8 | 9 | namespace BillsListASPNET.Controllers 10 | { 11 | public class CallbackController : Controller 12 | { 13 | // GET: Callback 14 | [Route("callback")] 15 | [HttpGet] 16 | public ActionResult Index() 17 | { 18 | var error = Request["error"]; 19 | var state = Request["state"]; 20 | if (!String.IsNullOrEmpty(error)) 21 | { 22 | return RedirectToAction("Error", "Home", null); 23 | } 24 | else 25 | { 26 | var group = Request["group_name"]; 27 | var webhook = Request["webhook_url"]; 28 | Subscription sub = new Subscription(); 29 | sub.GroupName = group; 30 | sub.WebHookUri = webhook; 31 | 32 | //return the partial subscription and add state and categories to ViewData 33 | ViewData.Add("state", state); 34 | ViewData.Add("categories", ItemsController.categories); 35 | return View(sub); 36 | } 37 | } 38 | 39 | [Route("callback")] 40 | [HttpPost] 41 | public ActionResult Index(Subscription sub) 42 | { 43 | //save the subscription 44 | using (BillsListEntities entities = new BillsListEntities()) 45 | { 46 | entities.Subscriptions.Add(sub); 47 | entities.SaveChanges(); 48 | 49 | //redirect back to the original location the user was at 50 | return Redirect(Request["state"]); 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace BillsListASPNET.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="BillsListASPNET.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace BillsListASPNET 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/BillsListModel.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | public partial class BillsListEntities : DbContext 17 | { 18 | public BillsListEntities() 19 | : base("name=BillsListEntities") 20 | { 21 | } 22 | 23 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 24 | { 25 | throw new UnintentionalCodeFirstException(); 26 | } 27 | 28 | public DbSet Items { get; set; } 29 | public DbSet Subscriptions { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/BillsListModel.Designer.cs: -------------------------------------------------------------------------------- 1 | // T4 code generation is enabled for model 'C:\Projects\Delete\BillsListASPNET\BillsListASPNET\Models\BillsListModel.edmx'. 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model 4 | // is open in the designer. 5 | 6 | // If no context and entity classes have been generated, it may be because you created an empty model but 7 | // have not yet chosen which version of Entity Framework to use. To generate a context class and entity 8 | // classes for your model, open the model in the designer, right-click on the designer surface, and 9 | // select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation 10 | // Item...'. -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/BillsListModel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/BillsListModel.edmx.diagram: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/Item.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Item 16 | { 17 | public int Id { get; set; } 18 | public string Title { get; set; } 19 | public Nullable Price { get; set; } 20 | public string Body { get; set; } 21 | public string Category { get; set; } 22 | public string Owner { get; set; } 23 | public System.DateTime PostDate { get; set; } 24 | public string Location { get; set; } 25 | public string Image { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Models/Subscription.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace BillsListASPNET.Models 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Subscription 16 | { 17 | public int Id { get; set; } 18 | public string GroupName { get; set; } 19 | public string WebHookUri { get; set; } 20 | public string Category { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BillsListASPNET")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BillsListASPNET")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d34847c0-0e2b-46e4-88f4-4aade23516c8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/Scripts/_references.js -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Owin; 5 | using Microsoft.IdentityModel.Protocols; 6 | using Microsoft.Owin.Security.Cookies; 7 | using Microsoft.Owin.Security.OpenIdConnect; 8 | using Microsoft.Owin.Security; 9 | using System.Globalization; 10 | using System.IdentityModel.Tokens; 11 | using System.Configuration; 12 | 13 | [assembly: OwinStartup(typeof(BillsListASPNET.Startup))] 14 | 15 | namespace BillsListASPNET 16 | { 17 | public class Startup 18 | { 19 | public static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; 20 | public static string clientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"]; 21 | public static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; 22 | public static string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"]; 23 | 24 | public void Configuration(IAppBuilder app) 25 | { 26 | app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 27 | 28 | app.UseCookieAuthentication(new CookieAuthenticationOptions()); 29 | 30 | app.UseOpenIdConnectAuthentication( 31 | new OpenIdConnectAuthenticationOptions 32 | { 33 | ClientId = clientId, 34 | Authority = String.Format(CultureInfo.InvariantCulture, aadInstance, "common", "/v2.0"), 35 | RedirectUri = redirectUri, 36 | Scope = "openid email profile", 37 | ResponseType = "id_token", 38 | PostLogoutRedirectUri = redirectUri, 39 | TokenValidationParameters = new TokenValidationParameters 40 | { 41 | ValidateIssuer = false, 42 | }, 43 | Notifications = new OpenIdConnectAuthenticationNotifications 44 | { 45 | AuthenticationFailed = (context) => 46 | { 47 | context.HandleResponse(); 48 | context.Response.Redirect("/Error?message=" + context.Exception.Message); 49 | return Task.FromResult(0); 50 | } 51 | } 52 | }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Callback/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Complete Office 365 Connection"; 4 | } 5 | @model BillsListASPNET.Models.Subscription 6 | 7 |

Complete Office 365 Connection

8 | @using (Html.BeginForm("index", "callback", FormMethod.Post, new { enctype = "multipart/form-data" })) 9 | { 10 |
11 |
12 | 13 | @Html.EditorFor(model => model.GroupName, new { htmlAttributes = new { @class = "form-control", disabled = "disabled" } }) 14 |
15 |
16 |
17 |
18 | 19 | @Html.DropDownListFor(model => model.Category, new SelectList((List)ViewData["categories"]), new { @class = "form-control" }) 20 | @Html.HiddenFor(model => model.WebHookUri) 21 | @Html.HiddenFor(model => model.GroupName) 22 | @Html.Hidden("state", ViewData["state"].ToString()) 23 |
24 |
25 | 26 |
27 | 28 |
29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

BillsList

7 |

BillsList is a free online classified advertisement site.

8 |

Learn more »

9 |
10 | 11 |
12 |
13 |

Getting started

14 |

View the latest sale listing across the entire site or by categories.

15 |

View listings »

16 |
17 |
18 |

Create a listing

19 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

20 |

Create listing »

21 |
22 |
23 |

My listings

24 |

Already have an active listing? View all of your listing using the my listings button below.

25 |

My listings »

26 |
27 |
-------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Items/Category.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Category"; 4 | } 5 | @model List 6 | 7 |

8 | for sale > @ViewData["category"] 9 |

10 |
11 | @foreach (var item in Model) 12 | { 13 |
14 |
15 | @item.Price 16 |
17 | 18 |
19 |
20 |
21 |
22 | @item.Title 23 |
24 |
25 |
26 | } 27 |
28 | 29 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Items/Create.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Create"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

Create

8 | @using (Html.BeginForm("create", "items", FormMethod.Post, new { enctype = "multipart/form-data" })) 9 | { 10 |
11 |
12 | 13 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 14 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 15 |
16 |
17 |
18 |
19 | 20 |
21 |
$
22 | @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } }) 23 |
24 | @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" }) 25 |
26 |
27 |
28 |
29 | 30 | @Html.EditorFor(model => model.Location, new { htmlAttributes = new { @class = "form-control" } }) 31 | @Html.ValidationMessageFor(model => model.Location, "", new { @class = "text-danger" }) 32 |
33 |
34 |
35 |
36 | 37 | @Html.DropDownListFor(model => model.Category, new SelectList((List)ViewData["categories"]), new { @class = "form-control" }) 38 | @Html.ValidationMessageFor(model => model.Category, "", new { @class = "text-danger" }) 39 |
40 |
41 |
42 |
43 | 44 | @Html.TextAreaFor(model => model.Body, new { cols = 35, @rows = 3, @class = "form-control" }) 45 | @Html.ValidationMessageFor(model => model.Body, "", new { @class = "text-danger" }) 46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 | 55 |
56 | 57 | @Html.ActionLink("Cancel", "My", new object() { }, new { @class = "btn btn-default" }) 58 |
59 | } 60 | 61 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Items/Detail.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Detail"; 4 | } 5 | @model BillsListASPNET.Models.Item 6 | 7 |

for sale > @Model.Title - @Model.Price (@Model.Location)

8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |
16 |

@Model.Body

17 |
18 |
19 |

Contact Seller

20 |
21 | 22 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Items/Index.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "Index"; 4 | } 5 | @model List 6 | 7 |

8 | for sale 9 |

10 |
11 | @foreach (var item in Model) 12 | { 13 |
14 |
15 | @item.Price 16 |
17 | 18 |
19 |
20 |
21 |
22 | @item.Title - @item.Category 23 |
24 |
25 |
26 | } 27 |
28 | 29 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Items/My.cshtml: -------------------------------------------------------------------------------- 1 |  2 | @{ 3 | ViewBag.Title = "My"; 4 | } 5 | @model List 6 | 7 |

for sale > me

8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | @foreach (var item in Model) 20 | { 21 | 22 | 23 | 24 | 25 | 26 | 27 | } 28 | 29 |
TitleCategoryPrice
(@Html.ActionLink("Delete", "Delete", new { id = item.Id }))@item.Title@item.Category@item.Price
30 |
31 |
32 | @Html.ActionLink("Create Listing", "Create", new object() { }, new { @class = "btn btn-default" }) 33 |
34 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 38 |
39 | @RenderBody() 40 |
41 | 42 | @Scripts.Render("~/bundles/jquery") 43 | @Scripts.Render("~/bundles/bootstrap") 44 | @RenderSection("scripts", required: false) 45 | 46 | 47 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/favicon.ico -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/End-EX4/BillsListASPNET/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Workshop/ASP.NET/End-EX4/BillsListASPNET/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_AddGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_AddGroup.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_CallbackCtrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_CallbackCtrl.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Card.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectBtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectBtn.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectMsg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectMsg.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectTo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectTo.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectToGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectToGroup.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Connectors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Connectors.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectorsAdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectorsAdd.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectorsForm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectorsForm.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ConnectorsMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ConnectorsMenu.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_DbCon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_DbCon2.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_GroupSelect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_GroupSelect.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Groups.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_HookDone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_HookDone.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_IncomingConfirmation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_IncomingConfirmation.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_IncomingWebhook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_IncomingWebhook.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Listings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Listings.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ManualConfirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ManualConfirm.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_ManualHook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_ManualHook.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_PubDB1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_PubDB1.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_SkypeChat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_SkypeChat.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Twitter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Twitter1.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Twitter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Twitter2.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_Twitter3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_Twitter3.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_presence1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_presence1.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_presence2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_presence2.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_signin.png -------------------------------------------------------------------------------- /Workshop/ASP.NET/Images/Mod4_tickets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/ASP.NET/Images/Mod4_tickets.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Begin/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Begin/NodeConnectors/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/bower_components" 3 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch", 6 | "type": "node", 7 | "request": "launch", 8 | "program": "${workspaceRoot}/bin/www", 9 | "stopOnEntry": false, 10 | "args": [], 11 | "cwd": "${workspaceRoot}", 12 | "preLaunchTask": null, 13 | "runtimeExecutable": null, 14 | "runtimeArgs": [ 15 | "--nolazy" 16 | ], 17 | "env": { 18 | "NODE_ENV": "development" 19 | }, 20 | "externalConsole": false, 21 | "sourceMaps": false, 22 | "outDir": null 23 | }, 24 | { 25 | "name": "Attach", 26 | "type": "node", 27 | "request": "attach", 28 | "port": 5858, 29 | "address": "localhost", 30 | "restart": false, 31 | "sourceMaps": false, 32 | "outDir": null, 33 | "localRoot": "${workspaceRoot}", 34 | "remoteRoot": null 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var path = require("path"); 3 | var favicon = require("serve-favicon"); 4 | var logger = require("morgan"); 5 | var cookieParser = require("cookie-parser"); 6 | var bodyParser = require("body-parser"); 7 | 8 | var routes = require("./routes/index"); 9 | var users = require("./routes/users"); 10 | var items = require("./routes/items"); 11 | var auth = require("./routes/auth"); 12 | 13 | var app = express(); 14 | 15 | // view engine setup 16 | app.set("views", path.join(__dirname, "views")); 17 | app.set("view engine", "hbs"); 18 | 19 | // uncomment after placing your favicon in /public 20 | //app.use(favicon(path.join(__dirname, "public", "favicon.ico"))); 21 | app.use(logger("dev")); 22 | app.use(bodyParser.json()); 23 | app.use(bodyParser.urlencoded({ extended: false })); 24 | app.use(cookieParser()); 25 | app.use(express.static(path.join(__dirname, "public"))); 26 | 27 | app.use("/", routes); 28 | app.use("/users", users); 29 | app.use("/items", items); 30 | app.use("/auth", auth); 31 | 32 | // catch 404 and forward to error handler 33 | app.use(function(req, res, next) { 34 | var err = new Error("Not Found"); 35 | err.status = 404; 36 | next(err); 37 | }); 38 | 39 | // error handlers 40 | 41 | // development error handler 42 | // will print stacktrace 43 | if (app.get("env") === "development") { 44 | app.use(function(err, req, res, next) { 45 | res.status(err.status || 500); 46 | res.render("error", { 47 | message: err.message, 48 | error: err 49 | }); 50 | }); 51 | } 52 | 53 | // production error handler 54 | // no stacktraces leaked to user 55 | app.use(function(err, req, res, next) { 56 | res.status(err.status || 500); 57 | res.render("error", { 58 | message: err.message, 59 | error: {} 60 | }); 61 | }); 62 | 63 | 64 | module.exports = app; 65 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/authHelper.js: -------------------------------------------------------------------------------- 1 | var https = require("https"); 2 | 3 | var appDetails = { 4 | authority: "https://login.microsoftonline.com/common", 5 | client_id: "ec684207-669e-41fa-a076-44b06861b5a7", 6 | client_secret: "g9fKgExBMStpwOC3nmz85Yy", 7 | redirect_url: "http://localhost:3000/auth", 8 | scopes: "openid email profile" 9 | }; 10 | 11 | //ensure the user is authenticated 12 | function ensureAuth(req, res) { 13 | if (req.cookies.TOKEN_CACHE_KEY === undefined) { 14 | res.redirect(getAuthUrl(res, "/items")); 15 | return false; 16 | } 17 | else { 18 | return true; 19 | } 20 | }; 21 | 22 | //builds a redirect url based on app detail 23 | function getAuthUrl(res, state) { 24 | return appDetails.authority + "/oauth2/v2.0/authorize" + 25 | "?client_id=" + appDetails.client_id + 26 | "&response_type=id_token" + 27 | "&redirect_uri=" + appDetails.redirect_url + 28 | "&response_mode=form_post" + 29 | "&scope=" + appDetails.scopes + 30 | "&state=" + state + 31 | "&nonce=somenonce"; 32 | }; 33 | 34 | 35 | 36 | //gets a token given an authorization code 37 | function getTokenFromCode(code, callback) { 38 | var payload = "grant_type=authorization_code" + 39 | "&redirect_uri=" + appDetails.redirect_url + 40 | "&client_id=" + appDetails.client_id + 41 | "&client_secret=" + appDetails.client_secret + 42 | "&code=" + code + 43 | "&scope=" + appDetails.scopes; 44 | 45 | postJson("login.microsoftonline.com", 46 | "/common/oauth2/v2.0/token", 47 | payload, 48 | function(token) { 49 | callback(token); 50 | }); 51 | }; 52 | 53 | //gets a new token given a refresh token 54 | function getTokenFromRefreshToken(token, callback) { 55 | var payload = "grant_type=refresh_token" + 56 | "&redirect_uri=" + appDetails.redirect_url + 57 | "&client_id=" + appDetails.client_id + 58 | "&client_secret=" + appDetails.client_secret + 59 | "&refresh_token=" + token + 60 | "&scope=" + appDetails.scopes; 61 | 62 | postJson("login.microsoftonline.com", 63 | "/common/oauth2/v2.0/token", 64 | payload, 65 | function(token) { 66 | callback(token); 67 | }); 68 | }; 69 | 70 | //performs a generic http POST and returns JSON 71 | function postJson(host, path, payload, callback) { 72 | var options = { 73 | host: host, 74 | path: path, 75 | method: "POST", 76 | headers: { 77 | "Content-Type": "application/x-www-form-urlencoded", 78 | "Content-Length": Buffer.byteLength(payload, "utf8") 79 | } 80 | }; 81 | 82 | var reqPost = https.request(options, function(res) { 83 | var body = ""; 84 | res.on("data", function(d) { 85 | body += d; 86 | }); 87 | res.on("end", function() { 88 | callback(JSON.parse(body)); 89 | }); 90 | res.on("error", function(e) { 91 | callback(null); 92 | }); 93 | }); 94 | 95 | //write the data 96 | reqPost.write(payload); 97 | reqPost.end(); 98 | }; 99 | 100 | exports.ensureAuth = ensureAuth; 101 | exports.getAuthUrl = getAuthUrl; 102 | exports.getTokenFromCode = getTokenFromCode; 103 | exports.getTokenFromRefreshToken = getTokenFromRefreshToken; 104 | exports.TOKEN_CACHE_KEY = "TOKEN_CACHE_KEY"; -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NodeConnectors", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "adal-node": "^0.1.20", 10 | "body-parser": "~1.13.2", 11 | "bootstrap": "^4.1.3", 12 | "cookie-parser": "~1.3.5", 13 | "debug": "~2.2.0", 14 | "express": "~4.13.1", 15 | "hbs": "~3.1.0", 16 | "morgan": ">=1.9.1", 17 | "serve-favicon": "~2.3.0", 18 | "mongojs": "*", 19 | "multiparty": "*", 20 | "btoa": "*", 21 | "imagemagick": "*" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | 10 | body { 11 | padding-top: 50px; 12 | padding-bottom: 20px; 13 | } 14 | 15 | /* Set padding to keep content from hitting the edges */ 16 | .body-content { 17 | padding-left: 15px; 18 | padding-right: 15px; 19 | } 20 | 21 | /* Override the default bootstrap behavior where horizontal description lists 22 | will truncate terms that are too long to fit in the left column 23 | */ 24 | .dl-horizontal dt { 25 | white-space: normal; 26 | } 27 | 28 | .card { 29 | margin-top: 10px; 30 | margin-bottom: 10px; 31 | border: 1px solid #ccc; 32 | border-radius: 5px; 33 | } 34 | 35 | .price { 36 | background-color: #fff; 37 | padding: 2px; 38 | border-radius: 3px 4px; 39 | border: 1px solid #ccc; 40 | } 41 | 42 | .price.abs { 43 | position: absolute; 44 | background-color: #fff; 45 | padding: 4px; 46 | border-radius: 5px 0px; 47 | border: 1px solid #ccc; 48 | z-index: 2000; 49 | } 50 | 51 | .img { 52 | width: 100%; 53 | height: calc(width * .7); 54 | overflow: hidden; 55 | } 56 | 57 | .details { 58 | padding: 5px; 59 | height: 70px; 60 | max-height: 70px; 61 | overflow: hidden; 62 | } 63 | 64 | .ratio { 65 | position:relative; 66 | width: 100%; 67 | height: 0; 68 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 69 | 70 | background-repeat: no-repeat; 71 | background-position: center center; 72 | background-size: cover; 73 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/routes/auth.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | var authHelper = require("../../authHelper.js"); 4 | 5 | /* POST to root of route */ 6 | router.post("/", function(req, res, next) { 7 | //TODO: should validate the id_token here 8 | var segments = req.body.id_token.split("."); 9 | var payload = JSON.parse(base64Decode(segments[1])); 10 | 11 | //save the preferred user as cookie 12 | res.cookie(authHelper.TOKEN_CACHE_KEY, payload.preferred_username); 13 | res.redirect(req.body.state); 14 | }); 15 | 16 | function base64Decode(str) { 17 | str += Array(5 - str.length % 4).join("="); 18 | str = str.replace(/\-/g, "+").replace(/_/g, "/"); 19 | return new Buffer(str, "base64").toString(); 20 | }; 21 | 22 | module.exports = router; 23 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get("/", function(req, res, next) { 6 | res.render("index", { title: "Express" }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/error.hbs: -------------------------------------------------------------------------------- 1 |

{{message}}

2 |

{{error.status}}

3 |
{{error.stack}}
4 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/index.hbs: -------------------------------------------------------------------------------- 1 |
2 |

BillsList

3 |

BillsList is a free online classified advertisement site.

4 |

Learn more »

5 |
6 | 7 |
8 |
9 |

Getting started

10 |

View the latest sale listing across the entire site or by categories.

11 |

View listings »

12 |
13 |
14 |

Create a listing

15 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

16 |

Create listing »

17 |
18 |
19 |

My listings

20 |

Already have an active listing? View all of your listing using the my listings button below.

21 |

My listings »

22 |
23 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/items/category.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale > {{category}} 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/items/create.hbs: -------------------------------------------------------------------------------- 1 |

Create

2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 |
$
14 | 15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 |
26 | 27 | 33 |
34 |
35 |
36 |
37 | 38 | 39 |
40 |
41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 |
49 | 50 | 51 |
52 |
53 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/items/detail.hbs: -------------------------------------------------------------------------------- 1 |

for sale > {{item.Title}} - {{item.Price}} ({{item.Location}})

2 |
3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 |

{{item.Body}}

11 |
12 |
13 |

Contact Seller

14 |
15 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/items/index.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/items/my.hbs: -------------------------------------------------------------------------------- 1 |

for sale > me

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{#each items}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | {{/each}} 21 | 22 |
TitleCategoryPrice
(delete){{Title}}{{Category}}{{Price}}
23 |
24 |
25 | Create Listing 26 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/Begin/NodeConnectors/views/layout.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{title}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 33 |
34 | {{{body}}} 35 |
36 | 37 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/End-EX3/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/End-EX3/NodeConnectors/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/bower_components" 3 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch", 6 | "type": "node", 7 | "request": "launch", 8 | "program": "${workspaceRoot}/bin/www", 9 | "stopOnEntry": false, 10 | "args": [], 11 | "cwd": "${workspaceRoot}", 12 | "preLaunchTask": null, 13 | "runtimeExecutable": null, 14 | "runtimeArgs": [ 15 | "--nolazy" 16 | ], 17 | "env": { 18 | "NODE_ENV": "development" 19 | }, 20 | "externalConsole": false, 21 | "sourceMaps": false, 22 | "outDir": null 23 | }, 24 | { 25 | "name": "Attach", 26 | "type": "node", 27 | "request": "attach", 28 | "port": 5858, 29 | "address": "localhost", 30 | "restart": false, 31 | "sourceMaps": false, 32 | "outDir": null, 33 | "localRoot": "${workspaceRoot}", 34 | "remoteRoot": null 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var path = require("path"); 3 | var favicon = require("serve-favicon"); 4 | var logger = require("morgan"); 5 | var cookieParser = require("cookie-parser"); 6 | var bodyParser = require("body-parser"); 7 | 8 | var routes = require("./routes/index"); 9 | var error = require("./routes/error"); 10 | var users = require("./routes/users"); 11 | var items = require("./routes/items"); 12 | var auth = require("./routes/auth"); 13 | var callback = require("./routes/callback"); 14 | 15 | var app = express(); 16 | 17 | // view engine setup 18 | app.set("views", path.join(__dirname, "views")); 19 | app.set("view engine", "hbs"); 20 | 21 | // uncomment after placing your favicon in /public 22 | //app.use(favicon(path.join(__dirname, "public", "favicon.ico"))); 23 | app.use(logger("dev")); 24 | app.use(bodyParser.json()); 25 | app.use(bodyParser.urlencoded({ extended: false })); 26 | app.use(cookieParser()); 27 | app.use(express.static(path.join(__dirname, "public"))); 28 | 29 | app.use("/", routes); 30 | app.use("/error", error); 31 | app.use("/users", users); 32 | app.use("/items", items); 33 | app.use("/auth", auth); 34 | app.use("/callback", callback); 35 | 36 | // catch 404 and forward to error handler 37 | app.use(function(req, res, next) { 38 | var err = new Error("Not Found"); 39 | err.status = 404; 40 | next(err); 41 | }); 42 | 43 | // error handlers 44 | 45 | // development error handler 46 | // will print stacktrace 47 | if (app.get("env") === "development") { 48 | app.use(function(err, req, res, next) { 49 | res.status(err.status || 500); 50 | res.render("error", { 51 | message: err.message, 52 | error: err 53 | }); 54 | }); 55 | } 56 | 57 | // production error handler 58 | // no stacktraces leaked to user 59 | app.use(function(err, req, res, next) { 60 | res.status(err.status || 500); 61 | res.render("error", { 62 | message: err.message, 63 | error: {} 64 | }); 65 | }); 66 | 67 | 68 | module.exports = app; 69 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NodeConnectors", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "adal-node": "^0.1.20", 10 | "body-parser": "~1.13.2", 11 | "bootstrap": "^3.3.6", 12 | "cookie-parser": "~1.3.5", 13 | "debug": ">=2.6.9", 14 | "express": "~4.13.1", 15 | "hbs": "~3.1.0", 16 | "morgan": ">=1.9.1", 17 | "serve-favicon": "~2.3.0", 18 | "mongojs": "*", 19 | "multiparty": "*", 20 | "btoa": "*", 21 | "imagemagick": "*" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | 10 | body { 11 | padding-top: 50px; 12 | padding-bottom: 20px; 13 | } 14 | 15 | /* Set padding to keep content from hitting the edges */ 16 | .body-content { 17 | padding-left: 15px; 18 | padding-right: 15px; 19 | } 20 | 21 | /* Override the default bootstrap behavior where horizontal description lists 22 | will truncate terms that are too long to fit in the left column 23 | */ 24 | .dl-horizontal dt { 25 | white-space: normal; 26 | } 27 | 28 | .card { 29 | margin-top: 10px; 30 | margin-bottom: 10px; 31 | border: 1px solid #ccc; 32 | border-radius: 5px; 33 | } 34 | 35 | .price { 36 | background-color: #fff; 37 | padding: 2px; 38 | border-radius: 3px 4px; 39 | border: 1px solid #ccc; 40 | } 41 | 42 | .price.abs { 43 | position: absolute; 44 | background-color: #fff; 45 | padding: 4px; 46 | border-radius: 5px 0px; 47 | border: 1px solid #ccc; 48 | z-index: 2000; 49 | } 50 | 51 | .img { 52 | width: 100%; 53 | height: calc(width * .7); 54 | overflow: hidden; 55 | } 56 | 57 | .details { 58 | padding: 5px; 59 | height: 70px; 60 | max-height: 70px; 61 | overflow: hidden; 62 | } 63 | 64 | .ratio { 65 | position:relative; 66 | width: 100%; 67 | height: 0; 68 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 69 | 70 | background-repeat: no-repeat; 71 | background-position: center center; 72 | background-size: cover; 73 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/routes/auth.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | var authHelper = require("../authHelper.js"); 4 | 5 | /* POST to root of route */ 6 | router.post("/", function(req, res, next) { 7 | //TODO: should validate the id_token here 8 | var segments = req.body.id_token.split("."); 9 | var payload = JSON.parse(base64Decode(segments[1])); 10 | 11 | //save the preferred user as cookie 12 | res.cookie(authHelper.TOKEN_CACHE_KEY, payload.preferred_username); 13 | res.redirect(req.body.state); 14 | }); 15 | 16 | function base64Decode(str) { 17 | str += Array(5 - str.length % 4).join("="); 18 | str = str.replace(/\-/g, "+").replace(/_/g, "/"); 19 | return new Buffer(str, "base64").toString(); 20 | }; 21 | 22 | module.exports = router; 23 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/routes/callback.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | var mongojs = require("mongojs"); 4 | var db = mongojs("billslist", ["subscriptions"]); 5 | 6 | /* GET /callback */ 7 | router.get("/", function(req, res, next) { 8 | //ensure the parameters were returned 9 | var error = req.query.error; 10 | var state = req.query.state; 11 | if (error !== undefined) { 12 | //something went wrong with consent flow 13 | res.redirect("/error?error=" + error); 14 | } 15 | else { 16 | var group = req.query.group_name; 17 | var webhook = req.query.webhook_url; 18 | 19 | //initialize the subscription 20 | var subscription = { 21 | GroupName: group, 22 | WebHookUri: webhook 23 | } 24 | 25 | //save the subscription and the redirect to state 26 | db.subscriptions.save(subscription, function(err, sub) { 27 | if( err || !sub ) { 28 | //something went wrong...redirect to error 29 | res.redirect("/error?error=subscription not saved"); 30 | } 31 | else { 32 | //redirect to original location (state) 33 | res.redirect(state); 34 | } 35 | }); 36 | } 37 | }); 38 | 39 | module.exports = router; 40 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/routes/error.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | 4 | /* GET error page. */ 5 | router.get("/error", function(req, res, next) { 6 | res.render("error", { title: "Error Occurred", error: req.query.error }); 7 | }); 8 | 9 | module.exports = router; -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get("/", function(req, res, next) { 6 | res.render("index", { title: "BillsList" }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/error.hbs: -------------------------------------------------------------------------------- 1 |

{{message}}

2 |

{{error.status}}

3 |
{{error.stack}}
4 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/index.hbs: -------------------------------------------------------------------------------- 1 |
2 |

BillsList

3 |

BillsList is a free online classified advertisement site.

4 |

Learn more »

5 |
6 | {{@exphbs.view}} 7 | {{@exphbs.layout}} 8 |
9 |
10 |

Getting started

11 |

View the latest sale listing across the entire site or by categories.

12 |

View listings »

13 |
14 |
15 |

Create a listing

16 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

17 |

Create listing »

18 |
19 |
20 |

My listings

21 |

Already have an active listing? View all of your listing using the my listings button below.

22 |

My listings »

23 |
24 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/items/category.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale > {{category}} 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/items/create.hbs: -------------------------------------------------------------------------------- 1 |

Create

2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 |
$
14 | 15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 |
26 | 27 | 33 |
34 |
35 |
36 |
37 | 38 | 39 |
40 |
41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 |
49 | 50 | 51 |
52 |
53 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/items/detail.hbs: -------------------------------------------------------------------------------- 1 |

for sale > {{item.Title}} - {{item.Price}} ({{item.Location}})

2 |
3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 |

{{item.Body}}

11 |
12 |
13 |

Contact Seller

14 |
15 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/items/index.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/items/my.hbs: -------------------------------------------------------------------------------- 1 |

for sale > me

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{#each items}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | {{/each}} 21 | 22 |
TitleCategoryPrice
(delete){{Title}}{{Category}}{{Price}}
23 |
24 |
25 | Create Listing 26 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX3/NodeConnectors/views/layout.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{title}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 37 |
38 | {{{body}}} 39 |
40 | 41 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/End-EX4/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/End-EX4/NodeConnectors/.DS_Store -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/bower_components" 3 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch", 6 | "type": "node", 7 | "request": "launch", 8 | "program": "${workspaceRoot}/bin/www", 9 | "stopOnEntry": false, 10 | "args": [], 11 | "cwd": "${workspaceRoot}", 12 | "preLaunchTask": null, 13 | "runtimeExecutable": null, 14 | "runtimeArgs": [ 15 | "--nolazy" 16 | ], 17 | "env": { 18 | "NODE_ENV": "development" 19 | }, 20 | "externalConsole": false, 21 | "sourceMaps": false, 22 | "outDir": null 23 | }, 24 | { 25 | "name": "Attach", 26 | "type": "node", 27 | "request": "attach", 28 | "port": 5858, 29 | "address": "localhost", 30 | "restart": false, 31 | "sourceMaps": false, 32 | "outDir": null, 33 | "localRoot": "${workspaceRoot}", 34 | "remoteRoot": null 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/app.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var path = require("path"); 3 | var favicon = require("serve-favicon"); 4 | var logger = require("morgan"); 5 | var cookieParser = require("cookie-parser"); 6 | var bodyParser = require("body-parser"); 7 | 8 | var routes = require("./routes/index"); 9 | var error = require("./routes/error"); 10 | var users = require("./routes/users"); 11 | var items = require("./routes/items"); 12 | var auth = require("./routes/auth"); 13 | var callback = require("./routes/callback"); 14 | 15 | var app = express(); 16 | 17 | // view engine setup 18 | app.set("views", path.join(__dirname, "views")); 19 | app.set("view engine", "hbs"); 20 | 21 | // uncomment after placing your favicon in /public 22 | //app.use(favicon(path.join(__dirname, "public", "favicon.ico"))); 23 | app.use(logger("dev")); 24 | app.use(bodyParser.json()); 25 | app.use(bodyParser.urlencoded({ extended: false })); 26 | app.use(cookieParser()); 27 | app.use(express.static(path.join(__dirname, "public"))); 28 | 29 | app.use("/", routes); 30 | app.use("/error", error); 31 | app.use("/users", users); 32 | app.use("/items", items); 33 | app.use("/auth", auth); 34 | app.use("/callback", callback); 35 | 36 | // catch 404 and forward to error handler 37 | app.use(function(req, res, next) { 38 | var err = new Error("Not Found"); 39 | err.status = 404; 40 | next(err); 41 | }); 42 | 43 | // error handlers 44 | 45 | // development error handler 46 | // will print stacktrace 47 | if (app.get("env") === "development") { 48 | app.use(function(err, req, res, next) { 49 | res.status(err.status || 500); 50 | res.render("error", { 51 | message: err.message, 52 | error: err 53 | }); 54 | }); 55 | } 56 | 57 | // production error handler 58 | // no stacktraces leaked to user 59 | app.use(function(err, req, res, next) { 60 | res.status(err.status || 500); 61 | res.render("error", { 62 | message: err.message, 63 | error: {} 64 | }); 65 | }); 66 | 67 | 68 | module.exports = app; 69 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NodeConnectors", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "adal-node": "^0.1.20", 10 | "body-parser": "~1.13.2", 11 | "bootstrap": "^4.1.3", 12 | "cookie-parser": "~1.3.5", 13 | "debug": "~2.2.0", 14 | "express": "~4.13.1", 15 | "hbs": "~3.1.0", 16 | "morgan": "~1.6.1", 17 | "serve-favicon": "~2.3.0", 18 | "mongojs": "*", 19 | "multiparty": "*", 20 | "btoa": "*", 21 | "imagemagick": "*" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | 10 | body { 11 | padding-top: 50px; 12 | padding-bottom: 20px; 13 | } 14 | 15 | /* Set padding to keep content from hitting the edges */ 16 | .body-content { 17 | padding-left: 15px; 18 | padding-right: 15px; 19 | } 20 | 21 | /* Override the default bootstrap behavior where horizontal description lists 22 | will truncate terms that are too long to fit in the left column 23 | */ 24 | .dl-horizontal dt { 25 | white-space: normal; 26 | } 27 | 28 | .card { 29 | margin-top: 10px; 30 | margin-bottom: 10px; 31 | border: 1px solid #ccc; 32 | border-radius: 5px; 33 | } 34 | 35 | .price { 36 | background-color: #fff; 37 | padding: 2px; 38 | border-radius: 3px 4px; 39 | border: 1px solid #ccc; 40 | } 41 | 42 | .price.abs { 43 | position: absolute; 44 | background-color: #fff; 45 | padding: 4px; 46 | border-radius: 5px 0px; 47 | border: 1px solid #ccc; 48 | z-index: 2000; 49 | } 50 | 51 | .img { 52 | width: 100%; 53 | height: calc(width * .7); 54 | overflow: hidden; 55 | } 56 | 57 | .details { 58 | padding: 5px; 59 | height: 70px; 60 | max-height: 70px; 61 | overflow: hidden; 62 | } 63 | 64 | .ratio { 65 | position:relative; 66 | width: 100%; 67 | height: 0; 68 | padding-bottom: 50% ; /* % of width, defines aspect ratio*/ 69 | 70 | background-repeat: no-repeat; 71 | background-position: center center; 72 | background-size: cover; 73 | } -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/routes/auth.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | var authHelper = require("../authHelper.js"); 4 | 5 | /* POST to root of route */ 6 | router.post("/", function(req, res, next) { 7 | //TODO: should validate the id_token here 8 | var segments = req.body.id_token.split("."); 9 | var payload = JSON.parse(base64Decode(segments[1])); 10 | 11 | //save the preferred user as cookie 12 | res.cookie(authHelper.TOKEN_CACHE_KEY, payload.preferred_username); 13 | res.redirect(req.body.state); 14 | }); 15 | 16 | function base64Decode(str) { 17 | str += Array(5 - str.length % 4).join("="); 18 | str = str.replace(/\-/g, "+").replace(/_/g, "/"); 19 | return new Buffer(str, "base64").toString(); 20 | }; 21 | 22 | module.exports = router; 23 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/routes/callback.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | var items = require("../routes/items.js"); 4 | var mongojs = require("mongojs"); 5 | var db = mongojs("billslist", ["subscriptions"]); 6 | 7 | /* GET /callback */ 8 | router.get("/", function(req, res, next) { 9 | //ensure the parameters were returned 10 | var error = req.query.error; 11 | var state = req.query.state; 12 | if (error !== undefined) { 13 | //something went wrong with consent flow 14 | res.redirect("/error?error=" + error); 15 | } 16 | else { 17 | var group = req.query.group_name; 18 | var webhook = req.query.webhook_url; 19 | 20 | //initialize the subscription 21 | var subscription = { 22 | GroupName: group, 23 | WebHookUri: webhook 24 | } 25 | 26 | res.render("callback/index", { 27 | title: "Complete Office 365 Connection", 28 | subscription: subscription, 29 | categories: items.categories, 30 | state: state }); 31 | } 32 | }); 33 | 34 | /* POST /callback */ 35 | router.post("/", function(req, res, next) { 36 | //repopulate the subscription for saving 37 | var subscription = { 38 | GroupName: req.body.GroupName, 39 | WebHookUri: req.body.hdnWebhook, 40 | Category: req.body.cboCategory 41 | }; 42 | 43 | //save the subscription and the redirect to state 44 | db.subscriptions.save(subscription, function(err, sub) { 45 | if( err || !sub ) { 46 | //something went wrong...redirect to error 47 | res.redirect("/error?error=subscription not saved"); 48 | } 49 | else { 50 | //redirect to original location (state) 51 | res.redirect(req.body.hdnState); 52 | } 53 | }); 54 | }); 55 | 56 | module.exports = router; 57 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/routes/error.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | 4 | /* GET error page. */ 5 | router.get("/error", function(req, res, next) { 6 | res.render("error", { title: "Error Occurred", error: req.query.error }); 7 | }); 8 | 9 | module.exports = router; -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | 4 | /* GET home page. */ 5 | router.get("/", function(req, res, next) { 6 | res.render("index", { title: "BillsList" }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/callback/index.hbs: -------------------------------------------------------------------------------- 1 |

Complete Office 365 Connection

2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 |
10 |
11 | 12 | 18 | 19 | 20 | 21 |
22 |
23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/error.hbs: -------------------------------------------------------------------------------- 1 |

{{message}}

2 |

{{error.status}}

3 |
{{error.stack}}
4 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/index.hbs: -------------------------------------------------------------------------------- 1 |
2 |

BillsList

3 |

BillsList is a free online classified advertisement site.

4 |

Learn more »

5 |
6 | {{@exphbs.view}} 7 | {{@exphbs.layout}} 8 |
9 |
10 |

Getting started

11 |

View the latest sale listing across the entire site or by categories.

12 |

View listings »

13 |
14 |
15 |

Create a listing

16 |

Got something to sell? You can sell it on BillsList. Just click the create listing button below to get started.

17 |

Create listing »

18 |
19 |
20 |

My listings

21 |

Already have an active listing? View all of your listing using the my listings button below.

22 |

My listings »

23 |
24 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/items/category.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale > {{category}} 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/items/create.hbs: -------------------------------------------------------------------------------- 1 |

Create

2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 |
$
14 | 15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 |
26 | 27 | 33 |
34 |
35 |
36 |
37 | 38 | 39 |
40 |
41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 |
49 | 50 | 51 |
52 |
53 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/items/detail.hbs: -------------------------------------------------------------------------------- 1 |

for sale > {{item.Title}} - {{item.Price}} ({{item.Location}})

2 |
3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 |

{{item.Body}}

11 |
12 |
13 |

Contact Seller

14 |
15 | -------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/items/index.hbs: -------------------------------------------------------------------------------- 1 |

2 | for sale 3 |

4 |
5 | {{#each items}} 6 |
7 |
8 | {{Price}} 9 |
10 | 11 |
12 |
13 |
14 |
15 | {{Title}} - {{Category}} 16 |
17 |
18 |
19 | {{/each}} 20 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/items/my.hbs: -------------------------------------------------------------------------------- 1 |

for sale > me

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{#each items}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | {{/each}} 21 | 22 |
TitleCategoryPrice
(delete){{Title}}{{Category}}{{Price}}
23 |
24 |
25 | Create Listing 26 |
-------------------------------------------------------------------------------- /Workshop/NodeJS/End-EX4/NodeConnectors/views/layout.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{title}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 37 |
38 | {{{body}}} 39 |
40 | 41 | -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_AddGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_AddGroup.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_CallbackCtrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_CallbackCtrl.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Card.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectBtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectBtn.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectMsg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectMsg.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectTo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectTo.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectToGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectToGroup.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Connectors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Connectors.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectorsAdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectorsAdd.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectorsForm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectorsForm.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ConnectorsMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ConnectorsMenu.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_DbCon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_DbCon2.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_GroupSelect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_GroupSelect.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Groups.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_HookDone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_HookDone.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_IncomingConfirmation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_IncomingConfirmation.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_IncomingWebhook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_IncomingWebhook.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Listings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Listings.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ManualConfirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ManualConfirm.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_ManualHook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_ManualHook.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_PubDB1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_PubDB1.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_SkypeChat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_SkypeChat.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Twitter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Twitter1.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Twitter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Twitter2.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_Twitter3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_Twitter3.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_presence1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_presence1.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_presence2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_presence2.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_signin.png -------------------------------------------------------------------------------- /Workshop/NodeJS/Images/Mod4_tickets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Office-365-Connectors/ab21e4b3012c5aac7d308498d85154262be92664/Workshop/NodeJS/Images/Mod4_tickets.png -------------------------------------------------------------------------------- /Workshop/README.md: -------------------------------------------------------------------------------- 1 | # Office-365-Connectors 2 | This repository contains technical documentation, samples, labs, and more related to Office 365 Connectors 3 | --------------------------------------------------------------------------------