Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial check-in of repository from Mercurial.

Check in just before publication of blog post.
  • Loading branch information...
commit 8ced86ac41b64c0c1a34d2a7e1c962653d333d96 1 parent c8d0db1
@arvindsuthar arvindsuthar authored
Showing with 42,126 additions and 0 deletions.
  1. +5 −0 .hg_archival.txt
  2. +13 −0 .hgignore
  3. +6 −0 .nuget/NuGet.Config
  4. +136 −0 .nuget/NuGet.targets
  5. +5 −0 .nuget/packages.config
  6. +172 −0 GraphHelper/AzureADAuthentication.cs
  7. +446 −0 GraphHelper/DirectoryClass.cs
  8. +55 −0 GraphHelper/DirectorySchemaExtensions.cs
  9. +87 −0 GraphHelper/GraphHelper.csproj
  10. +116 −0 GraphHelper/Logging/EventSource.cs
  11. +36 −0 GraphHelper/Properties/AssemblyInfo.cs
  12. +43 −0 GraphHelper/StringConstants.cs
  13. +2,651 −0 GraphHelper/WebRequest.cs
  14. +11 −0 GraphHelper/app.config
  15. +11 −0 GraphHelper/bin/Debug/Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll.config
  16. +1,826 −0 GraphHelper/bin/Debug/System.IdentityModel.Tokens.Jwt.xml
  17. +53 −0 GraphHelper/obj/Debug/GraphHelper.csproj.FileListAbsolute.txt
  18. 0  GraphHelper/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  19. 0  GraphHelper/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  20. 0  GraphHelper/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  21. +6 −0 GraphHelper/packages.config
  22. +26 −0 OrgChart.Tests/App.config
  23. +70 −0 OrgChart.Tests/Controllers/HomeControllerTest.cs
  24. +146 −0 OrgChart.Tests/OrgChart.Tests.csproj
  25. +39 −0 OrgChart.Tests/Properties/AssemblyInfo.cs
  26. 0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  27. 0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  28. 0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  29. +18 −0 OrgChart.Tests/packages.config
  30. +42 −0 OrgChart.sln
  31. +57 −0 OrgChart/App_Start/BundleConfig.cs
  32. +24 −0 OrgChart/App_Start/FilterConfig.cs
  33. +33 −0 OrgChart/App_Start/RouteConfig.cs
  34. +34 −0 OrgChart/App_Start/WebApiConfig.cs
  35. +774 −0 OrgChart/Content/Site.css
  36. BIN  OrgChart/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  37. BIN  OrgChart/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  38. BIN  OrgChart/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  39. BIN  OrgChart/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  40. BIN  OrgChart/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  41. BIN  OrgChart/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  42. BIN  OrgChart/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  43. BIN  OrgChart/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  44. BIN  OrgChart/Content/themes/base/images/ui-icons_222222_256x240.png
  45. BIN  OrgChart/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  46. BIN  OrgChart/Content/themes/base/images/ui-icons_454545_256x240.png
  47. BIN  OrgChart/Content/themes/base/images/ui-icons_888888_256x240.png
  48. BIN  OrgChart/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  49. +464 −0 OrgChart/Content/themes/base/jquery-ui.css
  50. +19 −0 OrgChart/Content/themes/base/jquery.ui.accordion.css
  51. +11 −0 OrgChart/Content/themes/base/jquery.ui.all.css
  52. +53 −0 OrgChart/Content/themes/base/jquery.ui.autocomplete.css
  53. +21 −0 OrgChart/Content/themes/base/jquery.ui.base.css
  54. +38 −0 OrgChart/Content/themes/base/jquery.ui.button.css
  55. +38 −0 OrgChart/Content/themes/base/jquery.ui.core.css
  56. +66 −0 OrgChart/Content/themes/base/jquery.ui.datepicker.css
  57. +21 −0 OrgChart/Content/themes/base/jquery.ui.dialog.css
  58. +11 −0 OrgChart/Content/themes/base/jquery.ui.progressbar.css
  59. +20 −0 OrgChart/Content/themes/base/jquery.ui.resizable.css
  60. +10 −0 OrgChart/Content/themes/base/jquery.ui.selectable.css
  61. +24 −0 OrgChart/Content/themes/base/jquery.ui.slider.css
  62. +18 −0 OrgChart/Content/themes/base/jquery.ui.tabs.css
  63. +247 −0 OrgChart/Content/themes/base/jquery.ui.theme.css
  64. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png
  65. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png
  66. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png
  67. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png
  68. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png
  69. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png
  70. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png
  71. BIN  OrgChart/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  72. BIN  OrgChart/Content/themes/base/minified/images/ui-icons_222222_256x240.png
  73. BIN  OrgChart/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png
  74. BIN  OrgChart/Content/themes/base/minified/images/ui-icons_454545_256x240.png
  75. BIN  OrgChart/Content/themes/base/minified/images/ui-icons_888888_256x240.png
  76. BIN  OrgChart/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png
  77. +5 −0 OrgChart/Content/themes/base/minified/jquery-ui.min.css
  78. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.accordion.min.css
  79. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.autocomplete.min.css
  80. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.button.min.css
  81. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.core.min.css
  82. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.datepicker.min.css
  83. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.dialog.min.css
  84. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.progressbar.min.css
  85. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.resizable.min.css
  86. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.selectable.min.css
  87. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.slider.min.css
  88. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.tabs.min.css
  89. +5 −0 OrgChart/Content/themes/base/minified/jquery.ui.theme.min.css
  90. +182 −0 OrgChart/Controllers/HomeController.cs
  91. +1 −0  OrgChart/Global.asax
  92. +45 −0 OrgChart/Global.asax.cs
  93. BIN  OrgChart/Images/accent.png
  94. BIN  OrgChart/Images/bullet.png
  95. BIN  OrgChart/Images/heroAccent.png
  96. BIN  OrgChart/Images/orderedList0.png
  97. BIN  OrgChart/Images/orderedList1.png
  98. BIN  OrgChart/Images/orderedList2.png
  99. BIN  OrgChart/Images/orderedList3.png
  100. BIN  OrgChart/Images/orderedList4.png
  101. BIN  OrgChart/Images/orderedList5.png
  102. BIN  OrgChart/Images/orderedList6.png
  103. BIN  OrgChart/Images/orderedList7.png
  104. BIN  OrgChart/Images/orderedList8.png
  105. BIN  OrgChart/Images/orderedList9.png
  106. +243 −0 OrgChart/Models/DirectoryExtensions.cs
  107. +294 −0 OrgChart/Models/Org.cs
  108. +321 −0 OrgChart/OrgChart.csproj
  109. +38 −0 OrgChart/Properties/AssemblyInfo.cs
  110. +603 −0 OrgChart/Scripts/NameControl.js
  111. BIN  OrgChart/Scripts/_references.js
  112. +2,494 −0 OrgChart/Scripts/jquery-1.8.2.intellisense.js
  113. +9,440 −0 OrgChart/Scripts/jquery-1.8.2.js
  114. +2 −0  OrgChart/Scripts/jquery-1.8.2.min.js
  115. +8 −0 OrgChart/Scripts/jquery-1.8.2.min.js.map
  116. +11,377 −0 OrgChart/Scripts/jquery-ui-1.8.24.js
  117. +5 −0 OrgChart/Scripts/jquery-ui-1.8.24.min.js
  118. +163 −0 OrgChart/Scripts/jquery.unobtrusive-ajax.js
  119. +5 −0 OrgChart/Scripts/jquery.unobtrusive-ajax.min.js
  120. +1,291 −0 OrgChart/Scripts/jquery.validate-vsdoc.js
  121. +1,248 −0 OrgChart/Scripts/jquery.validate.js
  122. +4 −0 OrgChart/Scripts/jquery.validate.min.js
  123. +367 −0 OrgChart/Scripts/jquery.validate.unobtrusive.js
  124. +5 −0 OrgChart/Scripts/jquery.validate.unobtrusive.min.js
  125. +3,577 −0 OrgChart/Scripts/knockout-2.2.0.debug.js
  126. +85 −0 OrgChart/Scripts/knockout-2.2.0.js
  127. +1,393 −0 OrgChart/Scripts/modernizr-2.6.2.js
  128. +34 −0 OrgChart/Views/Home/About.cshtml
  129. +50 −0 OrgChart/Views/Home/Contact.cshtml
  130. +399 −0 OrgChart/Views/Home/Index.cshtml
  131. +10 −0 OrgChart/Views/Shared/Error.cshtml
  132. +49 −0 OrgChart/Views/Shared/_Layout.cshtml
  133. +59 −0 OrgChart/Views/Web.config
  134. +3 −0  OrgChart/Views/_ViewStart.cshtml
  135. +30 −0 OrgChart/Web.Debug.config
  136. +31 −0 OrgChart/Web.Release.config
  137. +64 −0 OrgChart/Web.config
  138. BIN  OrgChart/favicon.ico
  139. 0  OrgChart/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  140. 0  OrgChart/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  141. 0  OrgChart/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  142. +31 −0 OrgChart/packages.config
  143. +102 −0 OrgChart/readme.txt
  144. +6 −0 packages/repositories.config
View
5 .hg_archival.txt
@@ -0,0 +1,5 @@
+repo: eab2ccc70985df82df8f4e391181a8c801ae251a
+node: a43218e1313725ee84e6f79ac5eb0641adeacad6
+branch: default
+latesttag: null
+latesttagdistance: 52
View
13 .hgignore
@@ -0,0 +1,13 @@
+syntax: glob
+
+TestResults/*
+*[Bb]in/
+*[Dd]ebug/
+*[Oo]bj/
+*[Rr]elease/
+*_[Rr]e[Ss]harper.*/
+*.docstates
+*.user
+*.suo
+*.xap
+[pP]ackages/
View
6 .nuget/NuGet.Config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <solution>
+ <add key="disableSourceControlIntegration" value="true" />
+ </solution>
+</configuration>
View
136 .nuget/NuGet.targets
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
+
+ <!-- Determines if package restore consent is required to restore packages -->
+ <RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
+
+ <!-- Download NuGet.exe if it does not already exist -->
+ <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
+ </PropertyGroup>
+
+ <ItemGroup Condition=" '$(PackageSources)' == '' ">
+ <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
+ <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
+ <!--
+ <PackageSource Include="https://www.nuget.org/api/v2/" />
+ <PackageSource Include="https://my-nuget-source/nuget/" />
+ -->
+ </ItemGroup>
+
+ <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
+ <!-- Windows specific commands -->
+ <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
+ <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
+ <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
+ <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
+ <PackagesConfig>packages.config</PackagesConfig>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- NuGet command -->
+ <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
+ <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
+
+ <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
+ <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
+
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
+ <NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
+
+ <PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
+ <PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
+
+ <!-- Commands -->
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
+ <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- We need to ensure packages are restored prior to assembly resolve -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ <!--
+ Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
+ This effectively acts as a lock that makes sure that the download operation will only happen once and all
+ parallel builds will have to wait for it to complete.
+ -->
+ <MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
+ </Target>
+
+ <Target Name="_DownloadNuGet">
+ <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
+ </Target>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
+
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ Condition=" '$(OS)' != 'Windows_NT' " />
+
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true"
+ Condition=" '$(OS)' == 'Windows_NT' " />
+ </Target>
+
+ <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <OutputFilename ParameterType="System.String" Required="true" />
+ </ParameterGroup>
+ <Task>
+ <Reference Include="System.Core" />
+ <Using Namespace="System" />
+ <Using Namespace="System.IO" />
+ <Using Namespace="System.Net" />
+ <Using Namespace="Microsoft.Build.Framework" />
+ <Using Namespace="Microsoft.Build.Utilities" />
+ <Code Type="Fragment" Language="cs">
+ <![CDATA[
+ try {
+ OutputFilename = Path.GetFullPath(OutputFilename);
+
+ Log.LogMessage("Downloading latest version of NuGet.exe...");
+ WebClient webClient = new WebClient();
+ webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
+
+ return true;
+ }
+ catch (Exception ex) {
+ Log.LogErrorFromException(ex);
+ return false;
+ }
+ ]]>
+ </Code>
+ </Task>
+ </UsingTask>
+</Project>
View
5 .nuget/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="HgIgnore" version="1.5" />
+ <package id="NuGetPowerTools" version="0.29" />
+</packages>
View
172 GraphHelper/AzureADAuthentication.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.IdentityModel.Clients;
+using Microsoft.IdentityModel.Clients.ActiveDirectory;
+using System.Threading;
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAzure.ActiveDirectory.GraphClient
+{
+ public class AzureADAuthentication
+ {
+ public AuthenticationResult AadAuthenticationResult;
+
+ // First Authn method OAuth Client credential flow (2-legged, S2S)
+ //
+ // 2-legged OAuth, describes a typical client-server scenario, without any user involvement.
+ // An example for such a scenario could be your Azure AD application accessing a consented tenant with no user interaction.
+ //
+ // On a conceptual level 2-legged OAuth simply consists of the first and last steps of 3-legged OAuth (see below):
+ // Client has signed up to the server and got his client credentials (also known as “consumer key and secret”)
+ // Client uses his client credentials (and empty token credentials) to access the protected resources on the server
+ //
+ public string GetToken(string tenant, string clientId, string clientSecret, string resource, string authnEndpoint, ref string strErrors)
+ {
+ string authString = authnEndpoint + tenant;
+ AuthenticationContext authenticationContext = new AuthenticationContext(authString);
+ try
+ {
+ ClientCredential clientCred = new ClientCredential(clientId, clientSecret);
+ AuthenticationResult authenticationResult = authenticationContext.AcquireToken(resource, clientCred);
+ Console.WriteLine("Token: \nToken Type: {0} \nExpires: {1}", authenticationResult.AccessTokenType, authenticationResult.ExpiresOn);
+ return authenticationResult.AccessToken;
+ }
+ catch (ActiveDirectoryAuthenticationException ex)
+ {
+ GraphHelperEventSourceLogger.Log(ex, ref strErrors);
+ return "";
+ }
+ }
+
+ // Second Authn method using OAuth Authorization Code grant flow (3-legged OAuth, user impersonation/delegation)
+ //
+ // 3-legged OAuth describes the scenario for which OAuth was originally developed: a resource owner wants to give a client
+ // access to a server without sharing his credentials (i.e. username/password).
+ //
+ // A typical example is a Facebook user (resource owner) who wants to give a facebook app (client) ability to write to her wall (server).
+ //
+ // On a conceptual level it works in the following way:
+ // Client has signed up to the server and got his client credentials (also known as “consumer key and secret”) ahead of time
+ // User wants to give the client access to his protected resources on the server
+ // Client retrieves the temporary credentials (also known as “request token”) from the server
+ // Client redirects the resource owner to the server
+ // Resource owner grants the client access to his protected resources on the server
+ // Server redirects the user back to the client
+ // Client uses the temporary credentials to retrieve the token credentials (also known as “access token”) from the server
+ // Client uses the token credentials to access the protected resources on the server
+ //
+ public string GetToken(string tenant, string clientId, Uri redirectUri, string resourceAppIdUri, string authnEndpoint, ref string strErrors)
+ {
+ // This method requests OAuth token using client code authn flow (3-legged)
+ // user must authenticate
+ string authString = authnEndpoint + tenant;
+ AuthenticationContext authenticationContext = new AuthenticationContext(authString);
+ AuthenticationResult userAuthnResult = null;
+ try
+ {
+ userAuthnResult = authenticationContext.AcquireToken(resourceAppIdUri, clientId, redirectUri);
+ Console.WriteLine("Token: \nToken Type: {0} \nExpires: {1}", userAuthnResult.AccessTokenType, userAuthnResult.ExpiresOn);
+ //Console.WriteLine("RefreshToken: {0}", userAuthnResult.RefreshToken);
+ return userAuthnResult.AccessToken;
+ }
+ catch (ActiveDirectoryAuthenticationException ex)
+ {
+ GraphHelperEventSourceLogger.Log(ex, ref strErrors);
+ return "";
+ }
+ }
+
+ // Third Authn method OAuth Client credential flow (2-legged, S2S)
+ // returns entire Authentication Result
+ public AuthenticationResult GetAuthenticationResult(string tenant, string clientId, string clientSecret,
+ string resource, string authnEndpoint, ref string strErrors)
+ {
+ string authString = authnEndpoint + tenant;
+ AuthenticationContext authenticationContext = new AuthenticationContext(authString);
+ try
+ {
+ ClientCredential clientCred = new ClientCredential(clientId, clientSecret);
+ AuthenticationResult authenticationResult = authenticationContext.AcquireToken(resource, clientCred);
+ //Console.WriteLine("Token: \nToken Type: {0} \nExpires: {1}", authenticationResult.AccessTokenType, authenticationResult.ExpiresOn);
+ return authenticationResult;
+ }
+ catch (ActiveDirectoryAuthenticationException ex)
+ {
+ GraphHelperEventSourceLogger.Log(ex, ref strErrors);
+ return null;
+ }
+ }
+
+ // Fourth Authn method OAuth Client Authorization Code grant flow (3-legged, user impersonation/delagion)
+ // returns entire Authentication Result
+ public AuthenticationResult GetAuthenticationResult(string tenant, string clientId, Uri redirectUri,
+ string resourceAppIdUri, string authnEndpoint, ref string strErrors)
+ {
+ // This method requests OAuth token using client code authn flow (3-legged)
+ // user must authenticate
+
+ string authString = authnEndpoint + tenant;
+ AuthenticationContext authenticationContext = new AuthenticationContext(authString);
+ AuthenticationResult userAuthnResult = null;
+
+ try
+ {
+ userAuthnResult = authenticationContext.AcquireToken(resourceAppIdUri, clientId, redirectUri);
+ Console.WriteLine("Token: \nToken Type: {0} \nExpires: {1}", userAuthnResult.AccessTokenType, userAuthnResult.ExpiresOn);
+ //Console.WriteLine("RefreshToken: {0}", userAuthnResult.RefreshToken);
+ return userAuthnResult;
+ }
+ catch (ActiveDirectoryAuthenticationException ex)
+ {
+ GraphHelperEventSourceLogger.Log(ex, ref strErrors);
+ return null;
+ }
+ }
+
+ // methods will get a new token.
+ public AuthenticationResult GetNewAuthenticationResult(ref string strErrors)
+ {
+ // check which type of token to acquire by checking to see if a refresh token is available
+ // (indicating OAuth Authz code grant flow)
+ if (this.AadAuthenticationResult.RefreshToken == null)
+ {
+ AzureADAuthentication appToken = new AzureADAuthentication();
+ AuthenticationResult applicationAuthnResult = appToken.GetAuthenticationResult(StringConstants.Tenant,
+ StringConstants.ClientId, StringConstants.ClientSecret,
+ StringConstants.Resource, StringConstants.AuthenticationEndpoint, ref strErrors);
+ return applicationAuthnResult;
+ }
+ else
+ {
+ AzureADAuthentication appToken = new AzureADAuthentication();
+ AuthenticationResult userAuthnResult = appToken.GetAuthenticationResult(StringConstants.Tenant,
+ StringConstants.ClientId, StringConstants.RedirectUri,
+ StringConstants.Resource, StringConstants.AuthenticationEndpoint, ref strErrors);
+ return userAuthnResult;
+ }
+
+ }
+ }
+}
+
+// Extension methods for Azure AD Authentication Library (ADAL)
+// check if token is expired or about to expire in specified minutes)
+namespace ExtensionMethods
+{
+ public static class MicrosoftIdentityModelExtensions
+ {
+ public static bool IsExpired(this AuthenticationResult authenticationResult)
+ {
+ return WillExpireIn(authenticationResult, 0);
+ }
+
+ public static bool WillExpireIn(this AuthenticationResult authenticationResult, double minutes)
+ {
+ DateTimeOffset datetimeoffset = DateTimeOffset.Now.UtcDateTime;
+ return datetimeoffset.AddMinutes(minutes) > authenticationResult.ExpiresOn;
+ }
+ }
+}
View
446 GraphHelper/DirectoryClass.cs
@@ -0,0 +1,446 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+using System.Net;
+using System.Web;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
+
+// for Graph API version 1.0, api-version=2013-04-05
+
+namespace Microsoft.WindowsAzure.ActiveDirectory.GraphClient
+{
+
+ [DataContract]
+ public class AadContacts
+ {
+ [DataMember(Name = "odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadContact> contact { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")] public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class AadContact
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember] public string objectType { get; set; }
+ [DataMember] public string city { get; set; } //" Type="Edm.String" />
+ [DataMember] public string country { get; set; } //" Type="Edm.String" />
+ [DataMember] public string department { get; set; } //" Type="Edm.String" />
+ [DataMember] public bool? dirSyncEnabled { get; set; } //" Type="Edm.Boolean" />
+ [DataMember] public string displayName { get; set; }
+ [DataMember] public string facsimileTelephoneNumber { get; set; } //" Type="Edm.String" />
+ [DataMember] public string givenName { get; set; } //" Type="Edm.String" />
+ [DataMember] public string jobTitle { get; set; } //" Type="Edm.String" />
+ [DataMember] public string lastDirSyncTime { get; set; } //" Type="Edm.DateTime" />
+ [DataMember] public string mail { get; set; } //" Type="Edm.String" />
+ [DataMember] public string mailNickname { get; set; } //" Type="Edm.String" />
+ [DataMember] public string mobile { get; set; } //" Type="Edm.String" />
+ [DataMember] public string physicalDeliveryOfficeName { get; set; } //" Type="Edm.String" />
+ [DataMember] public string postalCode { get; set; } //" Type="Edm.String" />
+ [DataMember] public string[] proxyAddresses { get; internal set; } //" Type="Collection(Edm.String)" Nullable="false" />
+ [DataMember] public List<provisioningError> provisioningErrors { get; set; } //" Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.ProvisioningError)" Nullable="false" />
+ [DataMember] public string state { get; set; } //" Type="Edm.String" />
+ [DataMember] public string streetAddress { get; set; } //" Type="Edm.String" />
+ [DataMember] public string surname { get; set; } //" Type="Edm.String" />
+ [DataMember] public string telephoneNumber { get; set; } //" Type="Edm.String" />
+ }
+
+ [DataContract]
+ public class AadUsers
+ {
+ [DataMember(Name="odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name="value")] public List<AadUser> user { get; set; } //collection
+ [DataMember(Name="odata.nextLink")] public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class JUsers
+ {
+ [DataMember(Name = "odata.metadata")]
+ public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")]
+ public List<JObject> users { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")]
+ public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class AadUser : AadContact
+ {
+ [DataMember] public string userPrincipalName { get; set; }
+ [DataMember] public bool accountEnabled { get; set; } //boolean
+ [DataMember] public List<assignedLicense> assignedLicenses { get; set; } //collection
+ [DataMember] public List<assignedPlan> assignedPlans { get; internal set; } //type="Collection(Microsoft.WindowsAzure.ActiveDirectory.AssignedPlan)" Nullable="false" />
+ [DataMember] public string[] otherMails { get; set; } //" Type="Collection(Edm.String)" Nullable="false" />
+ [DataMember] public string passwordPolicies { get; set; } //" Type="Edm.String" />
+ [DataMember] public passwordProfile passwordProfile { get; set; } //" Type="Microsoft.WindowsAzure.ActiveDirectory.PasswordProfile" />
+ [DataMember] public string preferredLanguage { get; set; } //" Type="Edm.String" />
+ [DataMember] public List<provisionedPlan> provisionedPlans { get; internal set; } //" Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.ProvisionedPlan)" Nullable="false" />
+ [DataMember] public string usageLocation { get; set; } //" Type="Edm.String" />
+ }
+
+ [DataContract]
+ public class AadGroups
+ {
+ [DataMember(Name = "odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadGroup> group { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")] public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class AadGroup : AadContact
+ {
+ // add unique group properties
+ [DataMember] public string description { get; set; }
+ [DataMember] public bool securityEnabled { get; set; }
+ [DataMember] public bool mailEnabled { get; set; }
+
+ }
+
+ [DataContract]
+ public class AadObjects
+ {
+ [DataMember(Name = "odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadObject> aadObject { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")] public string ODataNextLink { get; set; }
+ }
+
+
+ // AadObject can be a User,Group or Contact Object
+ // Therefore, we inherit from the user object (which inherits from contact object)
+ // then add Group specific properties.
+ [DataContract]
+ public class AadObject : AadUser
+ {
+ [DataMember] public string description { get; set; }
+ [DataMember] public bool securityEnabled { get; set; }
+ [DataMember] public bool mailEnabled { get; set; }
+ }
+
+
+ [DataContract]
+ public class AadRoles
+ {
+ [DataMember(Name = "odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadRole> role { get; set; } //collection
+ }
+
+ [DataContract]
+ public class AadRole
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember] public string objectType { get; set; }
+ [DataMember] public string description { get; set; }
+ [DataMember] public string displayName { get; set; }
+ [DataMember] public bool isSystem { get; set; }
+ [DataMember] public bool roleDisabled { get; set; }
+ }
+
+
+
+
+ [DataContract]
+ public class assignedLicense
+ {
+ [DataMember] public Guid skuId { get; set; }
+ [DataMember] public string[] disabledPlans {get; set;}
+ }
+
+ [DataContract]
+ public class userLicense
+ {
+
+ [DataMember]
+ public List<addLicense> addLicenses { get; set; }
+ [DataMember]
+ public string[] removeLicenses { get; set; }
+ // public List<removeLicense> removeLicenses { get; set; }
+ }
+
+ [DataContract]
+ public class addLicense
+ {
+ [DataMember]
+ public string[] disabledPlans { get; set; }
+ [DataMember]
+ public string skuId { get; set; }
+ }
+
+ [DataContract]
+ public class removeLicense
+ {
+ [DataMember]
+ public string[] skuId { get; set; }
+ }
+
+ [DataContract]
+ public class assignedPlan
+ {
+ [DataMember] public string assignedTimestamp { get; set; }
+ [DataMember] public string capabilityStatus { get; set; }
+ [DataMember] public string service { get; set; }
+ [DataMember] public Guid servicePlanId { get; set; }
+
+ }
+
+ [DataContract]
+ public class provisionedPlan
+ {
+ [DataMember] public string capabilityStatus { get; set; }
+ [DataMember] public string provisioningStatus { get; set; }
+ [DataMember] public string service { get; set; }
+ }
+
+ [DataContract]
+ public class provisioningError
+ {
+ [DataMember] public string errorDetail { get; set; }
+ [DataMember] public bool resolved { get; set; }
+ [DataMember] public string service { get; set; }
+ [DataMember]
+ public string timestamp { get; set; } //" Type="Edm.DateTime" />
+ }
+
+ [DataContract]
+ public class passwordProfile
+ {
+ [DataMember] public string password { get; set; }
+ [DataMember] public bool forceChangePasswordNextLogin { get; set; }
+ }
+
+ [DataContract]
+ public class AadTenantDetails
+ {
+ [DataMember(Name = "odata.metadata")]
+ public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadTenantDetail> tenant { get; set; } //collection
+ }
+
+ [DataContract]
+ public class AadTenantDetail
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember] public string objectType { get; set; }
+ [DataMember] public string city { get; set; } //" Type="Edm.String" />
+ [DataMember] public string country { get; set; } //" Type="Edm.String" />
+ [DataMember] public string companyLastDirSyncTime { get; set; } //" Type="Edm.DateTime" />
+ [DataMember] public bool? dirSyncEnabled { get; set; } //" Type="Edm.Boolean" />
+ [DataMember] public string displayName { get; set; }
+ [DataMember] public string countryLetterCode { get; set; } //" Type="Edm.String" />
+ [DataMember] public string preferredLanguage { get; set; } //" Type="Edm.String" />
+ [DataMember] public string state { get; set; } //" Type="Edm.String" />
+ [DataMember] public string street { get; set; } //" Type="Edm.String" />
+ [DataMember] public string postalCode { get; set; } //" Type="Edm.String" />
+ [DataMember] public string telephoneNumber { get; set; } //" Type="Edm.String" /
+ [DataMember] public string tenantType { get; set; }
+ [DataMember] public List<provisionedPlan> provisionPlans { get; set; } //" Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.ProvisionedPlan)" Nullable="false" />
+ [DataMember] public List<provisioningError> provisioningErrors { get; set; }
+ [DataMember] public List<assignedPlan> assignedPlans { get; set; } //" Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.ProvisioningError)" Nullable="false" />
+ [DataMember] public string[] marketingNotificationEmails { get; set; }
+ [DataMember] public string[] technicalNotificationMails { get; set; }
+ [DataMember] public List<verifiedDomain> verifiedDomains { get; set; }
+ }
+
+ [DataContract]
+ public class verifiedDomain
+ {
+ [DataMember] public string capabilities {get;set;}
+ [DataMember(Name="default")] public Boolean dfault {get; set;}
+ [DataMember] public string name {get;set;}
+ [DataMember] public string type {get;set;}
+ [DataMember] public string id { get; set; }
+ [DataMember] public Boolean initial {get;set;}
+ }
+
+ [DataContract]
+ public class AadSubscribedSkus
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember(Name = "value")]
+ public List<AadSubscribedSku> subscribedSku { get; set; } //collection
+ }
+
+ [DataContract]
+ public class AadSubscribedSku
+ {
+ [DataMember] public string capabilityStatus { get; set; }
+ [DataMember] public int consumedUnits { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember(Name="prepaidUnits")] public prePaidUnits prepaidUnits { get; set; }
+ [DataMember] public Guid skuId { get; set; }
+ [DataMember] public string skuPartNumber { get; set; }
+ [DataMember] public List<servicePlan> servicePlans { get; set; }
+ }
+
+ [DataContract]
+ public class prePaidUnits
+ {
+ [DataMember] public int enabled { get; set; }
+ [DataMember] public int suspended { get; set; }
+ [DataMember] public int warning { get; set; }
+ }
+
+ [DataContract]
+ public class servicePlan
+ {
+ [DataMember] public Guid servicePlanId { get; set; }
+ [DataMember] public string servicePlanName { get; set; }
+ }
+
+ public class urlLink
+ {
+ public string url { get; set; }
+
+ }
+
+ public class isMemberOfResult
+ {
+ public bool value { get; set; }
+ }
+
+ [DataContract]
+ public class MemberGroupsData
+ {
+ [DataMember(Name="odata.metadata")] public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")]
+ public string[] value { get; set; } //collection
+ }
+
+ [DataContract]
+ public class GroupIds
+ {
+ [DataMember]
+ public string[] groupIds { get; set; }
+ }
+
+ [DataContract]
+ public class AadApplications
+ {
+ [DataMember(Name = "odata.metadata")]
+ public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")]
+ public List<AadApplication> application { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")]
+ public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class AadApplication
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember] public string objectType { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember] public string appId {get; set;} // Type="Edm.Guid" />
+ [DataMember] public bool availableToOtherTenants {get; set;} // Type="Edm.Boolean" />
+ [DataMember] public string displayName {get; set;} // Type="Edm.String" />
+ [DataMember] public string errorUrl {get; set;} // Type="Edm.String" />
+ [DataMember] public string homepage {get; set;} // Type="Edm.String" />
+ [DataMember] public string[] identifierUris {get; set;} // Type="Collection(Edm.String)" Nullable="false" />
+ [DataMember] public List<KeyCredential> keyCredentials {get; set;} // Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.KeyCredential)" Nullable="false" />
+ [DataMember] public Stream mainLogo {get; set;} // Type="Edm.Stream" Nullable="false" />
+ [DataMember] public string logoutUrl {get; set;} // Type="Edm.String" />
+ [DataMember] public List<PasswordCredential> passwordCredentials {get; set;} // Type="Collection(Microsoft.WindowsAzure.ActiveDirectory.PasswordCredential)" Nullable="false" />
+ [DataMember] public bool publicClient {get; set;} // Type="Edm.Boolean" />
+ [DataMember] public string[] replyUrls {get; set;} // Type="Collection(Edm.String)" Nullable="false" />
+ [DataMember] public string samlMetadataUrl {get; set;} // Type="Edm.String" />
+
+ }
+
+ [DataContract]
+ public class AadServicePrincipals
+ {
+ [DataMember(Name = "odata.metadata")]
+ public string ODataMetadata { get; set; }
+ [DataMember(Name = "value")] public List<AadServicePrincipal> servicePrincipal { get; set; } //collection
+ [DataMember(Name = "odata.nextLink")]
+ public string ODataNextLink { get; set; }
+ }
+
+ [DataContract]
+ public class AadServicePrincipal
+ {
+ [DataMember(Name = "odata.type")] public string ODataType { get; set; }
+ [DataMember] public string objectType { get; set; }
+ [DataMember] public string objectId { get; set; }
+ [DataMember] public bool accountEnabled {get; set;} //"Edm.Boolean" />
+ [DataMember] public string appId {get; set;} //"Edm.Guid" />
+ [DataMember] public string displayName {get; set;} //"Edm.String" />
+ [DataMember] public string errorUrl {get; set;} //"Edm.String" />
+ [DataMember] public string homepage {get; set;} //"Edm.String" />
+ [DataMember] public List<KeyCredential> keyCredentials {get; set;} //"Collection(Microsoft.WindowsAzure.ActiveDirectory.KeyCredential)" Nullable="false" />
+ [DataMember] public string logoutUrl {get; set;} //"Edm.String" />
+ [DataMember] public List<PasswordCredential> passwordCredentials {get; set;} //"Collection(Microsoft.WindowsAzure.ActiveDirectory.PasswordCredential)" Nullable="false" />
+ [DataMember] public string publisherName {get; set;} //"Edm.String" />
+ [DataMember] public string[] replyUrls {get; set;} //"Collection(Edm.String)" Nullable="false" />
+ [DataMember] public string samlMetadataUrl {get; set;} //"Edm.String" />
+ [DataMember] public string[] servicePrincipalNames {get; set;} //"Collection(Edm.String)" Nullable="false" />
+ [DataMember] public string[] tags {get; set;} //"Collection(Edm.String)" Nullable="false" />
+ }
+
+ [DataContract]
+ public class KeyCredential
+ {
+
+ [DataMember] public string customKeyIdentifier {get;set;} // Type="Edm.Binary" />
+ [DataMember] public string endDate {get;set;} // Type="Edm.DateTime" />
+ [DataMember] public string keyId {get;set;} // Type="Edm.Guid" />
+ [DataMember] public string startDate {get;set;} // Type="Edm.DateTime" />
+ [DataMember] public string type {get;set;} // Type="Edm.String" />
+ [DataMember] public string usage {get;set;} // Type="Edm.String" />
+ [DataMember] public string value {get;set;} // Type="Edm.Binary" />
+ }
+
+ [DataContract]
+ public class PasswordCredential
+ {
+ [DataMember] public string customKeyIdentifier {get;set;} // Type="Edm.Binary" />
+ [DataMember] public string endDate {get;set;} // Type="Edm.DateTime" />
+ [DataMember] public string keyId {get;set;} // Type="Edm.Guid" />
+ [DataMember] public string startDate {get;set;} // Type="Edm.DateTime" />
+ [DataMember] public string value {get;set;} // Type="Edm.String" />
+ }
+
+ public class ExtensionDefinition
+ {
+ public string name { get; set; }
+ public string dataType { get; set; }
+ private IList<string> targetClasses = new List<string>();
+ public IList<string> targetObjects
+ {
+ get
+ {
+ return targetClasses;
+ }
+ }
+ }
+
+ [DataContract]
+ public class ODataError
+ {
+ [DataMember(Name = "odata.error")] public Error error { get; set; }
+ }
+
+ [DataContract]
+ public class Error
+ {
+ [DataMember] public string code { get; set; }
+ [DataMember] public Message message { get; set; }
+ }
+
+ [DataContract]
+ public class Message
+ {
+ [DataMember] public string lang { get; set; }
+ [DataMember] public string value { get; set; }
+ }
+}
View
55 GraphHelper/DirectorySchemaExtensions.cs
@@ -0,0 +1,55 @@
+namespace Microsoft.WindowsAzure.ActiveDirectory.GraphClient
+{
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ class DirectorySchemaExtensionsHelper
+ {
+ /// <summary>
+ /// Adds schema extensions to a specified object. The object passed in is usually a strongly typed version of an
+ /// object in the Azure Active Directory that supports schema extensions (such as AadUser, AadTenantDetails etc).
+ /// </summary>
+ /// <param name="o">The object to which schema extension values should be added.</param>
+ /// <param name="extensionValues">The extension names and values to add to the object.</param>
+ /// <returns>
+ /// A <see cref="JToken"/> object which contains all the original properties present in the object passed in and the
+ /// additional schema extensions that were added.
+ /// </returns>
+ /// <remarks>
+ /// Currently, only string and byte[] values are supported for schema extensions. Any other type of value will throw
+ /// an <see cref="InvalidOperationException"/>.
+ /// </remarks>
+ public static JToken AddSchemaExtensionsToObject(object o, IDictionary<string, object> extensionValues)
+ {
+ // Create serializer settings that will ignore null values on the original object
+ // before converting to JToken. This makes sure that when the JToken itself is serialized
+ // to JSON string, the null values don't materialize in the string representation.
+ JsonSerializerSettings jsonSettings = new JsonSerializerSettings();
+ jsonSettings.NullValueHandling = NullValueHandling.Ignore;
+ JsonSerializer serializer = JsonSerializer.CreateDefault(jsonSettings);
+ JToken extendedObject = JToken.FromObject(o, serializer);
+ foreach (var kvpair in extensionValues)
+ {
+ if (kvpair.Value is string)
+ {
+ extendedObject[kvpair.Key] = (string)kvpair.Value;
+ }
+ else if (kvpair.Value is byte[])
+ {
+ extendedObject[kvpair.Key] = Convert.ToBase64String((byte[])kvpair.Value);
+ }
+ else
+ {
+ throw new InvalidOperationException();
+ }
+ }
+
+ return extendedObject;
+ }
+ }
+}
View
87 GraphHelper/GraphHelper.csproj
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{9312BA81-F180-4A04-AF24-6D9848F4A9B6}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Microsoft.WindowsAzure.ActiveDirectory.GraphHelper</RootNamespace>
+ <AssemblyName>Microsoft.WindowsAzure.ActiveDirectory.GraphHelper</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.1.0.1\lib\net40\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.1.0.1\lib\net40\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Practices.EnterpriseLibrary.SemanticLogging">
+ <HintPath>..\packages\EnterpriseLibrary.SemanticLogging.1.0.1304.0\lib\NET45\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AzureADAuthentication.cs" />
+ <Compile Include="DirectoryClass.cs" />
+ <Compile Include="DirectorySchemaExtensions.cs" />
+ <Compile Include="Logging\EventSource.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="StringConstants.cs" />
+ <Compile Include="WebRequest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+ </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
116 GraphHelper/Logging/EventSource.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Diagnostics.Tracing;
+using System.Net;
+using Microsoft.IdentityModel.Clients.ActiveDirectory;
+using System.Runtime.Serialization.Json;
+using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;
+using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
+using System.IO;
+
+namespace Microsoft.WindowsAzure.ActiveDirectory.GraphClient
+{
+ // text formatter for concise output
+ public class GraphHelperEventTextFormatter : IEventTextFormatter
+ {
+ public GraphHelperEventTextFormatter() { }
+
+ private static string[] logFields = { "strContext", "strCode", "strMessage", "strDetail" };
+
+ public void WriteEvent(EventEntry eventEntry, TextWriter writer)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ writer.WriteLine("{0} {1}", eventEntry.GetFormattedTimestamp("yyyy.MM.dd hh.mm.ss"), FormatPayload(eventEntry));
+ Console.ResetColor();
+ }
+
+ private static string FormatPayload(EventEntry entry)
+ {
+ string strContext = null;
+ string strCode = null;
+ string strMessage = null;
+ string strDetail = null;
+ var eventSchema = entry.Schema;
+ var sb = new StringBuilder();
+ for(int i = 0; i < entry.Payload.Count; i++)
+ {
+ switch ((string)eventSchema.Payload[i])
+ {
+ case "strContext":
+ strContext = (string)entry.Payload[i];
+ break;
+ case "strCode":
+ strCode = (string)entry.Payload[i];
+ break;
+ case "strMessage":
+ strMessage = (string)entry.Payload[i];
+ break;
+ case "strDetail":
+ strDetail = (string)entry.Payload[i];
+ break;
+ }
+ }
+ switch(entry.EventId)
+ {
+ case 1:
+ // auth failure
+ sb.AppendFormat("{0}: {1}\r\n", strMessage, strDetail);
+ break;
+ case 2:
+ // web failure
+ sb.AppendFormat("{0}: {1}\r\n{2}\r\n", strCode, strDetail, strContext);
+ break;
+ }
+ return sb.ToString();
+ }
+ }
+
+ public class GraphHelperEventSourceLogger
+ {
+ static public void Log(ActiveDirectoryAuthenticationException authException, ref string strErrors)
+ {
+ string strMessage = authException.Message;
+ string strDetail = null;
+ if (authException.InnerException != null)
+ {
+ // You should implement retry and back-off logic per the guidance given here:http://msdn.microsoft.com/en-us/library/dn168916.aspx
+ // InnerException.Message contains the HTTP error status codes mentioned in the link above
+ strDetail = authException.InnerException.Message;
+ strErrors += strDetail;
+ }
+ GraphHelperEventSource.Log.AuthFailure(strMessage, strDetail);
+ }
+ static public void Log(WebException webException, ref string strErrors)
+ {
+ string strContext = webException.ToString();
+ var errorStream = webException.Response.GetResponseStream();
+ DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ODataError));
+ ODataError getError = (ODataError)(ser.ReadObject(errorStream));
+ string strCode = getError.error.code;
+ string strDetail = getError.error.message.value;
+ strErrors += strDetail;
+ GraphHelperEventSource.Log.WebFailure(strContext, strCode, strDetail);
+ }
+ }
+
+ [EventSource(Name = "GraphHelper")]
+ public class GraphHelperEventSource : EventSource
+ {
+ private static GraphHelperEventSource _log = new GraphHelperEventSource();
+ private GraphHelperEventSource() { }
+ public static GraphHelperEventSource Log { get { return _log; } }
+ [Event(1, Message = "")]
+ public void AuthFailure(string strMessage, string strDetail)
+ {
+ this.WriteEvent(1, strMessage, strDetail);
+ }
+ [Event(2, Message = "")]
+ public void WebFailure(string strContext, string strCode, string strDetail)
+ {
+ this.WriteEvent(2, strContext, strCode, strDetail);
+ }
+ }
+ }
View
36 GraphHelper/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GraphHelper")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("GraphHelper")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2c1bcb5b-30d2-4e51-b213-8e8b2605a8f5")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
43 GraphHelper/StringConstants.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.WindowsAzure.ActiveDirectory.GraphClient
+{
+ public class StringConstants
+ {
+
+ // resource that is used to request a token for
+ public const string Resource = "https://graph.windows.net";
+
+ //this is the STS endpoint for Windows Azure AD
+ public const string AuthenticationEndpoint = "https://login.windows.net/";
+
+ // The URL of Graph service endpoint
+ public const string BaseGraphUri = "https://graph.windows.net/";
+
+ // Graph API version
+ public const string ApiVersion = "api-version=1.21-preview";
+
+ // Graph API preview version
+ public const string ApiVersionPreview = "api-version=1.21-preview";
+
+ // Next section is tenant and application specific configuraiton.
+
+ // Your tenant objectId or tenant domain name – this can be any of a tenant's verified domain
+ public static string Tenant = "dxtest.onmicrosoft.com";
+
+ // Config for OAuth client credentials (2-legged OAuth, S2S Authn flow)
+ public static string ClientId = "eeed6b47-a902-4c40-94ae-76d30e26a5ef";
+ public static string AppObjectId = "a4eff3a2-2a90-494a-9db4-497958a0319f";
+ public static string ClientSecret = "WzeIRPCwE54thByEV1a8+uambXJkuCRB1xH/fcGhOmM=";
+
+ // FIXTHIS: Config for OAuth Authorization Code grant flow (3-legged OAuth Auth flow - includes user authentication)
+ //public const string clientIdForUserAuthn = "7318ca25-0f32-4d77-8843-2c4bc2a44326"; //for user_impersonation
+ public const string RedirectUri = "https://localhost";
+
+ public const string LogFile = "AADGraph.log";
+ }
+}
View
2,651 GraphHelper/WebRequest.cs
2,651 additions, 0 deletions not shown
View
11 GraphHelper/app.config
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
View
11 GraphHelper/bin/Debug/Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll.config
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
View
1,826 GraphHelper/bin/Debug/System.IdentityModel.Tokens.Jwt.xml
1,826 additions, 0 deletions not shown
View
53 GraphHelper/obj/Debug/GraphHelper.csproj.FileListAbsolute.txt
@@ -0,0 +1,53 @@
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Newtonsoft.Json.dll
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.xml
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Newtonsoft.Json.pdb
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Newtonsoft.Json.xml
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Microsoft.WindowsAzure.activeDirectory.GraphHelper.dll
+C:\GraphApp\GraphConsoleApp2\GraphHelper\bin\Debug\Microsoft.WindowsAzure.activeDirectory.GraphHelper.pdb
+C:\GraphApp\GraphConsoleApp2\GraphHelper\obj\Debug\Microsoft.WindowsAzure.activeDirectory.GraphHelper.dll
+C:\GraphApp\GraphConsoleApp2\GraphHelper\obj\Debug\Microsoft.WindowsAzure.activeDirectory.GraphHelper.pdb
+C:\GraphApp\GraphConsoleApp2\GraphHelper\obj\Debug\GraphHelper.csprojResolveAssemblyReference.cache
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Newtonsoft.Json.dll
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.xml
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Newtonsoft.Json.pdb
+C:\GraphApp\GraphConsoleApp\GraphHelper\bin\Debug\Newtonsoft.Json.xml
+C:\GraphApp\GraphConsoleApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\GraphApp\GraphConsoleApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Newtonsoft.Json.dll
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.xml
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\bin\Debug\Newtonsoft.Json.xml
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\Users\Rakesh\Documents\Visual Studio 2012\Projects\AADApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Newtonsoft.Json.dll
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.xml
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\bin\Debug\Newtonsoft.Json.xml
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+\\bec-file01\usershare\ravarna\AADApp\GraphHelper\obj\Debug\GraphHelper.csprojResolveAssemblyReference.cache
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll.config
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Newtonsoft.Json.dll
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.IdentityModel.Clients.ActiveDirectory.xml
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.xml
+C:\src\AAD\OrgChart\GraphHelper\bin\Debug\Newtonsoft.Json.xml
+C:\src\AAD\OrgChart\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.dll
+C:\src\AAD\OrgChart\GraphHelper\obj\Debug\Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.pdb
+C:\src\AAD\OrgChart\GraphHelper\obj\Debug\GraphHelper.csprojResolveAssemblyReference.cache
View
0  GraphHelper/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
No changes.
View
0  GraphHelper/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
No changes.
View
0  GraphHelper/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
No changes.
View
6 GraphHelper/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EnterpriseLibrary.SemanticLogging" version="1.0.1304.0" targetFramework="net45" />
+ <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="1.0.1" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />
+</packages>
View
26 OrgChart.Tests/App.config
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Note: Add entries to the App.config file for configuration settings
+ that apply only to the Test project.
+-->
+<configuration>
+ <appSettings>
+
+ </appSettings>
+
+ <connectionStrings>
+
+ </connectionStrings>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
View
70 OrgChart.Tests/Controllers/HomeControllerTest.cs
@@ -0,0 +1,70 @@
+// <copyright file="HomeControllerTest.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+namespace OrgChart.Tests.Controllers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Web.Mvc;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using OrgChart;
+ using OrgChart.Controllers;
+
+ /// <summary>
+ /// HomeControllerTest tests HomeController.
+ /// </summary>
+ [TestClass]
+ public class HomeControllerTest
+ {
+ /// <summary>
+ /// Index tests Index
+ /// </summary>
+ [TestMethod]
+ public void Index()
+ {
+ // Arrange
+ HomeController controller = new HomeController();
+
+ // Act
+ ViewResult result = controller.Index() as ViewResult;
+
+ // Assert
+ Assert.AreEqual("Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message);
+ }
+
+ /// <summary>
+ /// About tests About
+ /// </summary>
+ [TestMethod]
+ public void About()
+ {
+ // Arrange
+ HomeController controller = new HomeController();
+
+ // Act
+ ViewResult result = controller.About() as ViewResult;
+
+ // Assert
+ Assert.IsNotNull(result);
+ }
+
+ /// <summary>
+ /// Contact tests Contact
+ /// </summary>
+ [TestMethod]
+ public void Contact()
+ {
+ // Arrange
+ HomeController controller = new HomeController();
+
+ // Act
+ ViewResult result = controller.Contact() as ViewResult;
+
+ // Assert
+ Assert.IsNotNull(result);
+ }
+ }
+}
View
146 OrgChart.Tests/OrgChart.Tests.csproj
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FA964900-4D62-46AE-96BA-51BD757D0722}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OrgChart.Tests</RootNamespace>
+ <AssemblyName>OrgChart.Tests</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="Microsoft.Practices.EnterpriseLibrary.SemanticLogging">
+ <HintPath>..\packages\EnterpriseLibrary.SemanticLogging.1.0.1304.0\lib\NET45\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.ApplicationServices" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Web.Abstractions" />
+ <Reference Include="System.Web.Routing" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Web.Mvc.FixedDisplayModes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http">
+ </Reference>
+ <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.WebRequest">
+ </Reference>
+ <Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.20710.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.Razor.2.0.20715.0\lib\net40\System.Web.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Web.Http.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.OData.4.0.0\lib\net40\System.Web.Http.OData.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Data.Edm, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Data.Edm.5.2.0\lib\net40\Microsoft.Data.Edm.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Data.OData, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Data.OData.5.2.0\lib\net40\Microsoft.Data.OData.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Spatial, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\System.Spatial.5.2.0\lib\net40\System.Spatial.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Controllers\HomeControllerTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\OrgChart\OrgChart.csproj">
+ <Project>{C4990074-A5B5-4BC9-894C-8D824FBDE80C}</Project>
+ <Name>OrgChart</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
39 OrgChart.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,39 @@
+// <copyright file="AssemblyInfo.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OrgChart.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OrgChart.Tests")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7fa4d4ff-7355-482b-a098-9b50aa66de55")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
No changes.
View
0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
No changes.
View
0  OrgChart.Tests/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
No changes.
View
18 OrgChart.Tests/packages.config
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EnterpriseLibrary.SemanticLogging" version="1.0.1304.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.Mvc" version="4.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.Razor" version="2.0.20715.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.OData" version="4.0.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.Data.Edm" version="5.2.0" targetFramework="net45" />
+ <package id="Microsoft.Data.OData" version="5.2.0" targetFramework="net45" />
+ <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />
+ <package id="System.Spatial" version="5.2.0" targetFramework="net45" />
+</packages>
View
42 OrgChart.sln
@@ -0,0 +1,42 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrgChart", "OrgChart\OrgChart.csproj", "{C4990074-A5B5-4BC9-894C-8D824FBDE80C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9312BA81-F180-4A04-AF24-6D9848F4A9B6} = {9312BA81-F180-4A04-AF24-6D9848F4A9B6}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrgChart.Tests", "OrgChart.Tests\OrgChart.Tests.csproj", "{FA964900-4D62-46AE-96BA-51BD757D0722}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphHelper", "GraphHelper\GraphHelper.csproj", "{9312BA81-F180-4A04-AF24-6D9848F4A9B6}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{ED4C41FB-08CE-4733-BA77-55A3ED8EEDCF}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C4990074-A5B5-4BC9-894C-8D824FBDE80C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C4990074-A5B5-4BC9-894C-8D824FBDE80C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C4990074-A5B5-4BC9-894C-8D824FBDE80C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C4990074-A5B5-4BC9-894C-8D824FBDE80C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA964900-4D62-46AE-96BA-51BD757D0722}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA964900-4D62-46AE-96BA-51BD757D0722}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA964900-4D62-46AE-96BA-51BD757D0722}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA964900-4D62-46AE-96BA-51BD757D0722}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9312BA81-F180-4A04-AF24-6D9848F4A9B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9312BA81-F180-4A04-AF24-6D9848F4A9B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9312BA81-F180-4A04-AF24-6D9848F4A9B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9312BA81-F180-4A04-AF24-6D9848F4A9B6}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
57 OrgChart/App_Start/BundleConfig.cs
@@ -0,0 +1,57 @@
+// <copyright file="BundleConfig.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+namespace OrgChart
+{
+ using System.Web;
+ using System.Web.Optimization;
+
+ /// <summary>
+ /// BundleConfig bundles directives
+ /// </summary>
+ public class BundleConfig
+ {
+ /// <summary>
+ /// Registers bundles
+ /// </summary>
+ /// <param name="bundles">bundle parameter</param>
+ /// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725.
+ public static void RegisterBundles(BundleCollection bundles)
+ {
+ bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
+ "~/Scripts/jquery-{version}.js"));
+
+ bundles.Add(new ScriptBundle("~/bundles/NameControl").Include(
+ "~/Scripts/NameControl.js"));
+
+ bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
+ "~/Scripts/jquery-ui-{version}.js"));
+
+ bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
+ "~/Scripts/jquery.unobtrusive*",
+ "~/Scripts/jquery.validate*"));
+
+ // Use the development version of Modernizr to develop with and learn from. Then, when you're
+ // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
+ bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
+ "~/Scripts/modernizr-*"));
+
+ bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
+
+ bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
+ "~/Content/themes/base/jquery.ui.core.css",
+ "~/Content/themes/base/jquery.ui.resizable.css",
+ "~/Content/themes/base/jquery.ui.selectable.css",
+ "~/Content/themes/base/jquery.ui.accordion.css",
+ "~/Content/themes/base/jquery.ui.autocomplete.css",
+ "~/Content/themes/base/jquery.ui.button.css",
+ "~/Content/themes/base/jquery.ui.dialog.css",
+ "~/Content/themes/base/jquery.ui.slider.css",
+ "~/Content/themes/base/jquery.ui.tabs.css",
+ "~/Content/themes/base/jquery.ui.datepicker.css",
+ "~/Content/themes/base/jquery.ui.progressbar.css",
+ "~/Content/themes/base/jquery.ui.theme.css"));
+ }
+ }
+}
View
24 OrgChart/App_Start/FilterConfig.cs
@@ -0,0 +1,24 @@
+// <copyright file="FilterConfig.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+namespace OrgChart
+{
+ using System.Web;
+ using System.Web.Mvc;
+
+ /// <summary>
+ /// FilterConfig contains
+ /// </summary>
+ public class FilterConfig
+ {
+ /// <summary>
+ /// Registers filters
+ /// </summary>
+ /// <param name="filters">filters errors</param>
+ public static void RegisterGlobalFilters(GlobalFilterCollection filters)
+ {
+ filters.Add(new HandleErrorAttribute());
+ }
+ }
+}
View
33 OrgChart/App_Start/RouteConfig.cs
@@ -0,0 +1,33 @@
+// <copyright file="RouteConfig.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+namespace OrgChart
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.Mvc;
+ using System.Web.Routing;
+
+ /// <summary>
+ /// RouteConfig allows config of routes
+ /// </summary>
+ public class RouteConfig
+ {
+ /// <summary>
+ /// registers routes
+ /// </summary>
+ /// <param name="routes">route collection</param>
+ public static void RegisterRoutes(RouteCollection routes)
+ {
+ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+
+ routes.MapRoute(
+ name: "Default",
+ url: "{controller}/{action}",
+ defaults: new { controller = "Home", action = "Index" });
+ }
+ }
+}
View
34 OrgChart/App_Start/WebApiConfig.cs
@@ -0,0 +1,34 @@
+// <copyright file="WebApiConfig.cs" company="Microsoft">
+// Copyright (c) Microsoft. All rights reserved.
+// </copyright>
+
+namespace OrgChart
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web.Http;
+
+ /// <summary>
+ /// enables config
+ /// </summary>
+ public static class WebApiConfig
+ {
+ /// <summary>
+ /// registers config
+ /// </summary>
+ /// <param name="config">config enabling registration</param>
+ public static void Register(HttpConfiguration config)
+ {
+ config.Routes.MapHttpRoute(
+ name: "DefaultApi",
+ routeTemplate: "api/{controller}/{id}",
+ defaults: new { id = RouteParameter.Optional });
+
+ // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
+ // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
+ // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
+ ////config.EnableQuerySupport();
+ }
+ }
+}
View
774 OrgChart/Content/Site.css
@@ -0,0 +1,774 @@
+html {
+ background-color: #e2e2e2;
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ background-color: #333;
+ border-top: solid 10px #000;
+ color: #333;
+ font-size: .85em;
+ font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
+ margin: 0;
+ padding: 0;
+}
+
+div {
+ overflow: hidden;
+ vertical-align: middle;
+}
+
+a {
+ color: #333;
+ outline: none;
+ padding-left: 3px;
+ padding-right: 3px;
+ text-decoration: underline;
+}
+
+ a:link, a:visited,
+ a:active, a:hover {
+ color: #333;
+ }
+
+ a.tdTrio {
+ color:white;
+ }
+
+ a:hover {
+ background-color: #c7d1d6;
+ color: #333;
+ }
+
+header, footer, hgroup,
+nav, section {
+ display: block;
+}
+
+mark {
+ background-color: #a6dbed;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+.float-left {
+ float: left;
+}
+
+.float-right {
+ float: right;
+}
+
+.clear-fix:after {
+ content: ".";
+ clear: both;
+ display: block;
+ height: 0;
+ visibility: hidden;
+}
+
+h1, h2, h3,
+h4, h5, h6 {
+ color: #000;
+ margin-bottom: 0;
+ padding-bottom: 0;
+}
+
+h1 {
+ font-size: 2em;
+}
+
+h2 {
+ font-size: 1.75em;
+}
+
+h3 {
+ font-size: 1.2em;
+}
+
+h4 {
+ font-size: 1.1em;
+}
+
+h5, h6 {
+ font-size: 1em;
+}
+
+ h5 a:link, h5 a:visited, h5 a:active {
+ padding: 0;
+ text-decoration: none;
+ }
+
+
+/* main layout
+----------------------------------------------------------*/
+.content-wrapper {
+ margin: 0 auto;
+/* max-width: 960px;*/
+}
+
+#body {
+ background-color: #efeeef;
+ clear: both;
+ padding-bottom: 35px;
+}
+
+ .main-content {
+ background: url("../Images/accent.png") no-repeat;
+ padding-left: 10px;
+ padding-top: 30px;
+ }
+
+ .featured + .main-content {
+ background: url("../Images/heroAccent.png") no-repeat;
+ }
+
+header .content-wrapper {
+ padding-top: 20px;
+}
+
+footer {
+ clear: both;
+ background-color: #e2e2e2;
+ font-size: .8em;
+ height: 100px;
+}
+
+
+/* site title
+----------------------------------------------------------*/
+.site-title {
+ color: #c8c8c8;
+ font-family: Rockwell, Consolas, "Courier New", Courier, monospace;
+ font-size: 2.3em;
+ margin: 0;
+}
+
+.site-title a, .site-title a:hover, .site-title a:active {
+ background: none;
+ color: #c8c8c8;
+ outline: none;
+ text-decoration: none;
+}
+
+
+/* login
+----------------------------------------------------------*/
+#login {
+ display: block;
+ font-size: .85em;
+ margin: 0 0 10px;
+ text-align: right;
+}
+
+ #login a {
+ background-color: #d3dce0;
+ margin-left: 10px;
+ margin-right: 3px;
+ padding: 2px 3px;
+ text-decoration: none;
+ }
+
+ #login a.username {
+ background: none;
+ margin: 0;
+ padding: 0;
+ text-decoration: underline;
+ }
+
+ #login ul {
+ margin: 0;
+ }
+
+ #login li {
+ display: inline;
+ list-style: none;
+ }
+
+
+/* menu
+----------------------------------------------------------*/
+ul#menu {
+ font-size: 1.3em;
+ font-weight: 600;
+ margin: 0 0 5px;
+ padding: 0;
+ text-align: right;
+}
+
+ ul#menu li {
+ display: inline;
+ list-style: none;
+ padding-left: 15px;
+ }
+
+ ul#menu li a {
+ background: none;
+ color: #999;
+ text-decoration: none;
+ }
+
+ ul#menu li a:hover {
+ color: #333;
+ text-decoration: none;
+ }
+
+
+/* page elements
+----------------------------------------------------------*/
+/* featured */
+.featured {
+ background-color: #fff;
+}
+
+ .featured .content-wrapper {
+ background-color: #7ac0da;
+ background-image: -ms-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%);
+ background-image: -o-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%);
+ background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7ac0da), color-stop(1, #a4d4e6));
+ background-image: -webkit-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%);
+ background-image: linear-gradient(left, #7ac0da 0%, #a4d4e6 100%);
+ color: #3e5667;
+ padding: 20px 40px 30px 40px;
+ }
+
+ .featured hgroup.title h1, .featured hgroup.title h2 {
+ color: #fff;
+ }
+
+ .featured p {
+ font-size: 1.1em;
+ }
+
+/* page titles */
+hgroup.title {
+ margin-bottom: 10px;
+}
+
+hgroup.title h1, hgroup.title h2 {
+ display: inline;
+}
+
+hgroup.title h2 {
+ font-weight: normal;
+ margin-left: 3px;
+}
+
+/* features */
+section.feature {
+ width: 300px;
+ float: left;
+ padding: 10px;
+}
+
+/* ordered list */
+ol.round {
+ list-style-type: none;
+ padding-left: 0;
+}
+
+ ol.round li {
+ margin: 25px 0;
+ padding-left: 45px;
+ }
+
+ ol.round li.zero {
+ background: url("../Images/orderedList0.png") no-repeat;
+ }
+
+ ol.round li.one {
+ background: url("../Images/orderedList1.png") no-repeat;
+ }
+
+ ol.round li.two {
+ background: url("../Images/orderedList2.png") no-repeat;
+ }
+
+ ol.round li.three {
+ background: url("../Images/orderedList3.png") no-repeat;