forked from davidebbo/BusinessPlatformApps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bdc7ed4
Showing
2,381 changed files
with
370,047 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
################################################################################ | ||
# This .gitignore file was automatically created by Microsoft(R) Visual Studio. | ||
################################################################################ | ||
|
||
|
||
*.nupkg | ||
/Source/**/bin/**/* | ||
/Source/**/obj/**/* | ||
/Source/**/packages/**/* | ||
/Source/Actions/*/scripts/**/* | ||
/Source/Commomn/*/scripts/**/* | ||
/Source/Actions/Microsoft.Deployment.Actions.Test/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.SQL/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.OnPremise/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.Custom/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.Common/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.AzureCustom/StyleCop.Cache | ||
/Source/Actions/Microsoft.Deployment.Actions.ADF/StyleCop.Cache | ||
*.suo | ||
**/*/.vs/**/* | ||
**/*/jspm_packages/**/* | ||
/Source/Site/Microsoft.Deployment.Site.Web/node_modules | ||
/Source/Site/Microsoft.Deployment.Site.Web/wwwroot/dist | ||
*.coverage | ||
/Source/Actions/.vs/config/applicationhost.config | ||
/Source/Apps/Microsoft/Released/Microsoft-SCCMTemplate/Resources/SCCM_Sample.pbix | ||
*.dg | ||
*.wixpdb | ||
/Source/Apps/Microsoft/Released/Microsoft-SCCMTemplate/Microsoft-SCCMTemplate.exe | ||
/Source/Apps/Microsoft/Released/Microsoft-SCCMTemplate/Microsoft-SCCMTemplate.msi | ||
*.sqlite | ||
/.vs/slnx.sqlite | ||
/.vs/slnx.sqlite | ||
*.vspscc | ||
/Source/Apps/Microsoft/Released/Microsoft-SapAccountsReceivable/Microsoft-SapAccountsReceivable.exe | ||
/Private | ||
/Source/Site/Microsoft.Deployment.Site.Web/typings | ||
/Source/Site/Microsoft.Deployment.Site.Web/wwwroot/config.js | ||
/Source/Site/UpgradeLog.htm | ||
/Source/Site/Microsoft.Deployment.Site.Service/PartnerServiceWSDL/partner.xml | ||
/Source/Apps/Test/TemplateApps/Microsoft-NewsTemplateTest/v1.txt | ||
/Source/Apps/Test/TemplateApps/Microsoft-NewsTemplateTest/v2.txt | ||
/.vs | ||
/Source/Apps/Microsoft/Released/Microsoft-TwitterTemplate/Service/PowerApp | ||
/Source/Apps/Microsoft/Released/Simplement-SAP-ARTemplate/Simplement-SAP-ARTemplate.exe | ||
/Source/Apps/Microsoft/Released/Simplement-SAP-ARTemplate/Simplement-SAP-ARTemplate.msi | ||
/Source/Apps/Microsoft/Released/Microsoft-SCCM2/Microsoft-SCCM2.exe | ||
/Source/Apps/Microsoft/Released/Microsoft-SCCM2/Microsoft-SCCM2.msi | ||
|
||
/Source/Site/Microsoft.Deployment.Site.Web/global.json | ||
*.user | ||
*js.map | ||
/Source/SiteCommon/Web/**/*.js | ||
*.pubxml | ||
/Function/FacebookOAuth/obj/Debug | ||
/Function/FacebookOAuth/bin/Debug | ||
/Function/packages | ||
/Function/FacebookUtillity/obj/Debug | ||
/Function/FacebookUtilityTest/obj/Debug | ||
/Function/FacebookUtilityTest/obj/Debug | ||
/Function/process/bin | ||
/Function/FacebookUtilityTest/bin/Debug | ||
/Functions/Code/Facebook/FacebookOAuth/obj/Debug | ||
/Functions/Code/Facebook/FacebookUtillity/obj/Debug | ||
/Functions/Code/Facebook/packages | ||
/Functions/Code/Facebook/process/bin | ||
/Functions/Code/Facebook/FacebookUtilityTest/obj/Debug | ||
/Functions/Code/Facebook/FacebookUtilityTest/bin/Debug | ||
/Function/FacebookUtilityTest/obj/Release | ||
/Function/FacebookUtillity/obj/Release/CoreCompileInputs.cache | ||
/Functions/Code/Reddit/Src/RedditAzureFunctions/obj | ||
/Functions/Code/Reddit/Src/RedditCore/obj | ||
/Functions/Code/Reddit/Src/RedditAzureFunctions/bin/ | ||
/Functions/Code/Reddit/Src/RedditCore/bin/ | ||
/Functions/Code/Reddit/Test/RedditCoreTest/obj/ | ||
/Functions/Code/Reddit/packages/ | ||
/Functions/Code/Facebook/FacebookUtillity/obj/Release | ||
/Functions/Code/Facebook/FacebookUtilityTest/obj/Release | ||
/Functions/Code/Facebook/FacebookOAuth/obj/Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26430.16 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FacebookUtillity", "FacebookUtillity\FacebookUtillity.csproj", "{26D8C540-34DE-4137-8861-A77158B73A49}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FacebookUtilityTest", "FacebookUtilityTest\FacebookUtilityTest.csproj", "{9F47835F-0263-4069-B2AD-03FC4B901B9A}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FacebookOAuth", "FacebookOAuth\FacebookOAuth.csproj", "{E87543E4-731A-447E-AA0B-C27499B9A290}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{26D8C540-34DE-4137-8861-A77158B73A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{26D8C540-34DE-4137-8861-A77158B73A49}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{26D8C540-34DE-4137-8861-A77158B73A49}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{26D8C540-34DE-4137-8861-A77158B73A49}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9F47835F-0263-4069-B2AD-03FC4B901B9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9F47835F-0263-4069-B2AD-03FC4B901B9A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9F47835F-0263-4069-B2AD-03FC4B901B9A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9F47835F-0263-4069-B2AD-03FC4B901B9A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E87543E4-731A-447E-AA0B-C27499B9A290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E87543E4-731A-447E-AA0B-C27499B9A290}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E87543E4-731A-447E-AA0B-C27499B9A290}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E87543E4-731A-447E-AA0B-C27499B9A290}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
65 changes: 65 additions & 0 deletions
65
Functions/Code/Facebook/FacebookOAuth/FacebookOAuth.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" 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>{E87543E4-731A-447E-AA0B-C27499B9A290}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>FacebookOAuth</RootNamespace> | ||
<AssemblyName>FacebookOAuth</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<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' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<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=3.16.0.14, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.3.16.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.16.0.14, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.3.16.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net.Http.WebRequest" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using Microsoft.IdentityModel.Clients.ActiveDirectory.Internal; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace FacebookOAuth | ||
{ | ||
class Program | ||
{ | ||
public const string clientId = ""; | ||
public const string clientSecret = ""; | ||
public const string redirectUri = "https://localhost/"; | ||
public static string code = string.Empty; | ||
public string devCode = ""; | ||
|
||
[STAThread] | ||
static void Main(string[] args) | ||
{ | ||
code = GetToken(clientId, redirectUri).Result; | ||
var shortLivedAccessToken = GetAccessToken($"https://graph.facebook.com/oauth/access_token?client_id={clientId}&client_secret={clientSecret}&redirect_uri={redirectUri}&code={code}").Result; | ||
var longLivedAccessToken = GetAccessToken($"https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={clientId}&client_secret={clientSecret}&fb_exchange_token={shortLivedAccessToken}").Result; | ||
var id = GetUserId($"https://graph.facebook.com/v2.10/me?access_token={longLivedAccessToken}").Result; | ||
var pageToken = GetAccessToken($"https://graph.facebook.com/v2.10/{id}/accounts?access_token={longLivedAccessToken}").Result; | ||
} | ||
|
||
public static async Task<string> GetUserId(string uri) | ||
{ | ||
string requestUri = uri; | ||
HttpClient client = new HttpClient(); | ||
var response = await client.GetAsync(requestUri); | ||
string responseObj = await response.Content.ReadAsStringAsync(); | ||
if (!response.IsSuccessStatusCode) | ||
{ | ||
throw new Exception(); | ||
} | ||
|
||
string id = JObject.Parse(responseObj)["id"].ToString(); | ||
return id; | ||
} | ||
|
||
public static async Task<string> GetToken(string clientId, string redirectUri) | ||
{ | ||
var url = $"https://www.facebook.com/v2.10/dialog/oauth?client_id={clientId}&redirect_uri={redirectUri}&response_type=code&granted_scopes=manage_pages,publish_pages"; | ||
var code = string.Empty; | ||
WindowsFormsWebAuthenticationDialog form = new WindowsFormsWebAuthenticationDialog(null); | ||
form.WebBrowser.Navigated += delegate (object sender, WebBrowserNavigatedEventArgs args) | ||
{ | ||
if (args.Url.ToString().StartsWith("https://localhost")) | ||
{ | ||
string tempcode = args.Url.ToString(); | ||
tempcode = tempcode.Substring(tempcode.IndexOf("code=") + 5); | ||
code = tempcode; | ||
form.Close(); | ||
}; | ||
}; | ||
form.WebBrowser.Navigate(url); | ||
form.ShowBrowser(); | ||
|
||
while (string.IsNullOrEmpty(code)) | ||
{ | ||
await Task.Delay(5000); | ||
} | ||
|
||
return code; | ||
} | ||
|
||
public static async Task<string> GetAccessToken(string uri) | ||
{ | ||
string requestUri = uri; | ||
HttpClient client = new HttpClient(); | ||
var response = await client.GetAsync(requestUri); | ||
string responseObj = await response.Content.ReadAsStringAsync(); | ||
if (!response.IsSuccessStatusCode) | ||
{ | ||
throw new Exception(); | ||
} | ||
|
||
string accessToken = JObject.Parse(responseObj)["access_token"].ToString(); | ||
return accessToken; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Functions/Code/Facebook/FacebookOAuth/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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("FacebookOAuth")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("FacebookOAuth")] | ||
[assembly: AssemblyCopyright("Copyright © 2017")] | ||
[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("e87543e4-731a-447e-aa0b-c27499b9a290")] | ||
|
||
// 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")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.16.0" targetFramework="net452" /> | ||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
Oops, something went wrong.