diff --git a/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs b/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs
index 0844984556e..6268868a59e 100644
--- a/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs
+++ b/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs
@@ -16,6 +16,8 @@
using Microsoft.Graph.PowerShell.Authentication.Properties;
using Microsoft.PowerShell.Commands;
+using Newtonsoft.Json;
+
using DriveNotFoundException = System.Management.Automation.DriveNotFoundException;
namespace Microsoft.Graph.PowerShell.Authentication.Cmdlets
@@ -552,7 +554,10 @@ private HttpResponseMessage GetResponse(HttpClient client, HttpRequestMessage re
}
///
- /// Set the request content
+ /// Set the request content.
+ /// Convert Dictionaries to Json
+ /// Passing a dictionary to the body object should be translated to Json.
+ /// Almost everything on Microsoft Graph works converts dictionaries and arrays to JSON.
///
///
///
@@ -568,8 +573,8 @@ private long SetRequestContent(HttpRequestMessage request, IDictionary content)
{
throw new ArgumentNullException(nameof(content));
}
-
- var body = content.FormatDictionary();
+ // Covert all dictionaries to Json
+ var body = JsonConvert.SerializeObject(content);
return SetRequestContent(request, body);
}
@@ -668,6 +673,8 @@ private void FillRequestStream(HttpRequestMessage request)
{
content = psBody.BaseObject;
}
+ // Passing a dictionary to the body object should be translated to Json.
+ // Almost everything on Microsoft Graph works converts dictionaries and arrays to JSON.
if (content is IDictionary dictionary && request.Method != HttpMethod.Get)
{
SetRequestContent(request, dictionary);
@@ -703,14 +710,15 @@ private void FillRequestStream(HttpRequestMessage request)
}
// Add the content headers
- if (request.Content == null)
+ // Only Set Content Headers when its not a GET Request
+ if (request.Content == null && this.Method != GraphRequestMethod.GET)
{
request.Content = new StringContent(string.Empty);
request.Content.Headers.Clear();
}
foreach (var entry in GraphRequestSession.ContentHeaders.Where(header =>
- !string.IsNullOrWhiteSpace(header.Value)))
+ !string.IsNullOrWhiteSpace(header.Value)))
{
if (SkipHeaderValidation)
{
@@ -724,7 +732,8 @@ private void FillRequestStream(HttpRequestMessage request)
}
catch (FormatException ex)
{
- var outerEx = new ValidationMetadataException(Resources.ContentTypeExceptionErrorMessage, ex);
+ var outerEx =
+ new ValidationMetadataException(Resources.ContentTypeExceptionErrorMessage, ex);
var er = new ErrorRecord(outerEx, Errors.InvokeGraphContentTypeException,
ErrorCategory.InvalidArgument, ContentType);
ThrowTerminatingError(er);
diff --git a/src/Authentication/Authentication/Helpers/ContentHelper.cs b/src/Authentication/Authentication/Helpers/ContentHelper.cs
index 8526d0cca9a..a35885bed8e 100644
--- a/src/Authentication/Authentication/Helpers/ContentHelper.cs
+++ b/src/Authentication/Authentication/Helpers/ContentHelper.cs
@@ -135,7 +135,7 @@ private static bool CheckIsText(string contentType)
|| CheckIsJson(contentType);
// Further content type analysis is available on Windows
- if (Platform.IsWindows && !isText)
+ if (OperatingSystem.IsWindows() && !isText)
{
// Media types registered with Windows as having a perceived type of text, are text
using (var contentTypeKey = Registry.ClassesRoot.OpenSubKey(@"MIME\Database\Content Type\" + contentType))
diff --git a/src/Authentication/Authentication/Helpers/InvokeGraphRequestUserAgent.cs b/src/Authentication/Authentication/Helpers/InvokeGraphRequestUserAgent.cs
index 65c5724d2d3..cb8ff8cc418 100644
--- a/src/Authentication/Authentication/Helpers/InvokeGraphRequestUserAgent.cs
+++ b/src/Authentication/Authentication/Helpers/InvokeGraphRequestUserAgent.cs
@@ -55,7 +55,7 @@ internal string PlatformName
{
get
{
- if (Platform.IsWindows)
+ if (OperatingSystem.IsWindows())
{
// only generate the windows user agent once
if (_windowsUserAgent == null)
@@ -69,11 +69,11 @@ internal string PlatformName
return _windowsUserAgent;
}
- else if (Platform.IsMacOS)
+ else if (OperatingSystem.IsMacOS())
{
return "Macintosh";
}
- else if (Platform.IsLinux)
+ else if (OperatingSystem.IsLinux())
{
return "Linux";
}
diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj b/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj
index f23d91f04ec..76627c8d751 100644
--- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj
+++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj
@@ -27,7 +27,6 @@
-
diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1 b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1
index e249bdf23e5..fe97302236b 100644
--- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1
+++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Microsoft
#
-# Generated on: 5/4/2020
+# Generated on: 8/12/2020
#
@{
@@ -12,7 +12,7 @@
RootModule = './Microsoft.Graph.Authentication.psm1'
# Version number of this module.
-ModuleVersion = '0.9.0'
+ModuleVersion = '0.9.1'
# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
@@ -72,7 +72,8 @@ FormatsToProcess = './Microsoft.Graph.Authentication.format.ps1xml'
FunctionsToExport = @()
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
-CmdletsToExport = 'Connect-Graph', 'Disconnect-Graph', 'Get-MgContext', 'Get-MgProfile', 'Select-MgProfile', 'Invoke-GraphRequest'
+CmdletsToExport = 'Connect-Graph', 'Disconnect-Graph', 'Get-MgContext', 'Get-MgProfile',
+ 'Select-MgProfile', 'Invoke-GraphRequest'
# Variables to export from this module
# VariablesToExport = @()
diff --git a/src/Identity.TermsOfUse/Identity.TermsOfUse/Microsoft.Graph.Identity.TermsOfUse.psd1 b/src/Identity.TermsOfUse/Identity.TermsOfUse/Microsoft.Graph.Identity.TermsOfUse.psd1
index 3d907c3e30b..75c08dcfcba 100644
--- a/src/Identity.TermsOfUse/Identity.TermsOfUse/Microsoft.Graph.Identity.TermsOfUse.psd1
+++ b/src/Identity.TermsOfUse/Identity.TermsOfUse/Microsoft.Graph.Identity.TermsOfUse.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
-# Generated on: 6/30/2020
+# Generated on: 8/11/2020
#
@{
@@ -12,13 +12,13 @@
RootModule = './Microsoft.Graph.Identity.TermsOfUse.psm1'
# Version number of this module.
-ModuleVersion = '0.5.1'
+ModuleVersion = '0.9.0'
# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
# ID used to uniquely identify this module
-GUID = 'e2dba82b-3bad-46a7-ac83-ecfe5e873824'
+GUID = 'ffdc7898-a776-425d-ad61-339458b87aa4'
# Author of this module
Author = 'Microsoft Corporation'
@@ -51,7 +51,7 @@ DotNetFrameworkVersion = '4.7.2'
# ProcessorArchitecture = ''
# Modules that must be imported into the global environment prior to importing this module
-RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '0.7.0'; })
+RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '0.9.0'; })
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = './bin/Microsoft.Graph.Identity.TermsOfUse.private.dll'
@@ -70,11 +70,15 @@ FormatsToProcess = './Microsoft.Graph.Identity.TermsOfUse.format.ps1xml'
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-MgAgreement', 'Get-MgAgreementAcceptance', 'Get-MgAgreementFile',
- 'Get-MgUserAgreementAcceptance', 'New-MgAgreement',
+ 'Get-MgAgreementFileLocalization', 'Get-MgUserAgreementAcceptance',
+ 'Get-MgUserAgreementAcceptanceByRef', 'New-MgAgreement',
'New-MgAgreementAcceptance', 'New-MgAgreementFile',
- 'Remove-MgAgreement', 'Remove-MgAgreementAcceptance',
- 'Update-MgAgreement', 'Update-MgAgreementAcceptance',
- 'Update-MgAgreementFile'
+ 'New-MgAgreementFileLocalization',
+ 'New-MgUserAgreementAcceptanceByRef', 'Remove-MgAgreement',
+ 'Remove-MgAgreementAcceptance', 'Remove-MgAgreementFile',
+ 'Remove-MgAgreementFileLocalization', 'Update-MgAgreement',
+ 'Update-MgAgreementAcceptance', 'Update-MgAgreementFile',
+ 'Update-MgAgreementFileLocalization'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
diff --git a/src/Identity.TermsOfUse/Identity.TermsOfUse/readme.md b/src/Identity.TermsOfUse/Identity.TermsOfUse/readme.md
index d247b2bc351..32dc3aa4c3d 100644
--- a/src/Identity.TermsOfUse/Identity.TermsOfUse/readme.md
+++ b/src/Identity.TermsOfUse/Identity.TermsOfUse/readme.md
@@ -32,6 +32,20 @@ title: $(service-name)
subject-prefix: ''
```
+
+### Directives
+
+> see https://github.com/Azure/autorest/blob/master/docs/powershell/directives.md
+
+``` yaml
+directive:
+# Rename cmdlets
+ - where:
+ subject: AgreementFile
+ variant: Get1|GetViaIdentity1|Delete1|DeleteViaIdentity1|Update1|UpdateExpanded1|UpdateViaIdentity1|UpdateViaIdentityExpanded1
+ remove: true
+```
+
### Versioning
``` yaml