GithubHelp home page GithubHelp logo

microsoftgraph / msgraph-sdk-code-generator Goto Github PK

View Code? Open in Web Editor NEW
95.0 35.0 74.0 7.93 MB

MSGraph SDK Code Generator

License: Other

C# 47.86% PowerShell 0.84% Batchfile 0.01% Java 39.50% Objective-C 6.58% PHP 5.22%
microsoftgraph devxeng

msgraph-sdk-code-generator's Introduction

Build status

Microsoft Graph SDK Code Generator

Source code writers for VIPR utilizing T4 templates. The GraphODataTemplateWriter receives an OdcmModel from VIPR and uses it to fill in a T4 template located within this repository.

Currently the following target languages are supported by this writer:

  • CSharp
  • Java
  • Objective-C
  • Python
  • TypeScript
  • PHP

Contents

Prerequisites

Getting started

This project uses git submodules to integrate upstream dependencies, specifically Vipr. If you need an alternate branch to include special fixes you'll need to check that out manually within the submodule.

For the solution to open properly, ensure submodules are updated before opening it in Visual Studio. When initially cloning this repo, use git clone --recursive to update submodules at the same time. Later, run git submodule update to manually update submodules. If you don't use the --recursive switch when cloning, run git submodule init first to initialize the submodule.

Once setup is complete, you can work with the GraphODataTemplateWriter solution as usual. If you encounter problems, make sure NuGet packages and project references are all up-to-date.

For more information on submodules read this chapter from the Git book and search the Web.

Using Typewriter

Typewriter is a new solution for generating code files using the GraphODataTemplateWriter and VIPR. It is an executable that is intended to simplify the generation of code files. Build the solution to find the typewriter executable in \MSGraph-SDK-Code-Generator\src\Typewriter\bin\Release. The typewriter run options are:

  • -l, -language: The target language for the generated code files. The values can be: Java, ObjC, CSharp, PHP, Python, TypeScript, or GraphEndpointList. The default value is CSharp. This is not applicable when only generating clean and annotated metadata as specified by the -generationmode Metadata option.
  • -m, -metadata: The local file path or URL to the target input metadata. The default value is https://graph.microsoft.com/v1.0/$metadata. This value is required.
  • -v, -verbosity: The log verbosity level. The values can be: Minimal, Info, Debug, or Trace. The default value is Minimal.
  • -o, -output: Specifies the path to the output folder. The default value is the directory that contains typewriter.exe. The structure and contents of the output directory will be different based on the -generationmode and -language options.
  • -d, -docs: Specifies the path to the base endpoint directory in the microsoft-graph-docs repo. For example, use c:\microsoft-graph-docs\api-reference\v1.0\ for the v1.0 endpoint documentation. The documentation is parsed to provide documentation annotations to the metadata which is then used to add doc comments in the generated code files. This option is required when using -generationmode values of Metadata, Full, or TransformWithDocs.
  • -g, -generationmode: Specifies the generation mode. The values can be: Full, Metadata, Files, Transform or TransformWithDocs. Full (default) generation mode produces the output code files by cleaning the input metadata, parsing the documentation, and adding annotations before generating the output files. Metadata generation mode produces an output metadata file by cleaning metadata, documentation parsing, and adding documentation annotations. Files generation mode produces code files from an input metadata and bypasses the cleaning, documentation parsing, and adding documentation annotations. Transform generation mode processes the metadata according to the XSLT provided with the -t option. TransformWithDocs generation mode processes the metadata according to the XSLT and adds documentation annotations. Transform and TransformWithDocs require the -t argument to specify the XSLT file.
  • -f, -outputMetadataFileName: The base output metadata filename. Only applicable for -generationmode Metadata. The default value is cleanMetadataWithDescriptions which is used with the value of the -endpointVersion to generate a metadata file named cleanMetadataWithDescriptionsv1.0.xml.
  • -e, -endpointVersion: The endpoint version used when naming a metadata file. Expected values are v1.0 and beta. Only applicable for -generationmode Metadata.
  • -p, -properties: Specify properties to support generation logic in the T4 templates. Properties must take the form of key-string:value-string. Multiple properties can be specified by setting a space in between property. The only property currently supported is the php.namespace property to specify the generated model file namespace. This property is optional.
  • -t, -transform: Specify the URI to the XSLT that will preprocess the metadata. Only applicable for -generationmode Transform or -generationmode TransformWitDocs.
  • -r, -removeannotations: Specifies whether to remove capability annotations from the metadata. The default value is true. Only applicable for -generationmode Transform or -generationmode TransformWithDocs.

Example typewriter usage

Transform metadata with XSLT.

The output cleanMetadata.xml will be located in the same directory as typewriter.exe.

.\typewriter.exe -v Info -m https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/v1.0_metadata.xml -g Transform -t https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/transforms/csdl/preprocess_csdl.xsl

Transform metadata with XSLT and add documentation annotations.

The output cleanMetadataWithDescriptionsv1.0.xml will be located in the same directory as typewriter.exe.

.\typewriter.exe -v Info -m https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/v1.0_metadata.xml -g TransformWithDocs -t https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/transforms/csdl/preprocess_csdl.xsl -d D:\repos\microsoft-graph-docs

Generate TypeScript typings from a CSDL (metadata) file without cleaning or annotating the CSDL.

The output will go in to the outputTypeScript directory.

.\typewriter.exe -v Info -m D:\cleanMetadataWithDescriptions_v10.xml -o outputTypeScript -l TypeScript -g Files

Clean and annotate a metadata file with documentation annotations sourced from the documentation repo

The output metadata file will go in to the output2 directory. The output metadata file will be named cleanMetadataWithDescriptionsv1.0.xml based on the default values.

.\typewriter.exe -v Info -m D:\v1.0_2018_10_23_source.xml -o output2 -d D:\repos\microsoft-graph-docs -g Metadata

Generate C# code files from the metadata that will be cleaned and annotated with documentation annotations sourced from the documentation repo

The output C# code files will go in to the output directory.

.\typewriter.exe -v Info -m D:\v1.0_2018_10_23_source.xml -o output -l CSharp -d D:\repos\microsoft-graph-docs -g Full

Use/debug Typewriter in VSCode

  • Prerequisite is that msgraph-metadata is checked out at the same root folder as MSGraph-SDK-Code-Generator.
  • launch.json file contains main generation scenarios for each language/endpoint pair. Running Typewriter using one of those generation scenarios (e.g. Generate CSharp beta) will output the corresponding models into a folder, which will be a sibling to MSGraph-SDK-Code-Generator. The folder will be named as generator-output-<language>-<endpoint> e.g. generator-output-CSharp-beta.

Use Typewriter to test your beta metadata

We assume that the metadata you are using is based off the beta metadata file.

  1. Download the latest Typewriter release.
  2. Run Typewriter to generate a clean metadata file from your test metadata file. The output file will be cleanMetadata.xml.

.\typewriter.exe -v Info -m <TODO-SET-PATH-TO-YOUR-METADATA> -g Transform -t https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/transforms/csdl/preprocess_csdl.xsl

  1. Generate .NET code files with Typewriter using the generated cleanMetadata.xml.

.\typewriter.exe -v Info -m D:\cleanMetadata.xml -o outputDirectory -g Files

  1. Clone the Beta .NET SDK https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet.
  2. Replace the files under src/Microsoft.Graph/Requests/Generated and src/Microsoft.Graph/Models/Generated in the Beta .Net SDK with the generated files.
  3. Build the Beta .Net SDK to validate that the generated files compile.

At this point you should have a valid SDK.

Using Vipr with this Writer

  1. Build the solution in Visual Studio.
  2. Go to the src\GraphODataTemplateWriter\bin\debug folder to find all compiled components.
  3. In that folder, modify .config\TemplateWriterSettings.json to specify your template mapping see Template Writer Settings for more details.
  4. Open a command prompt as administrator in the same folder and run Vipr.exe <path-or-url-to-metadata> --writer="GraphODataTemplateWriter". An example metadata file can be found in the root of this project.

By default, output source code will be put in a folder named "output" next to the Vipr executable.

Template Writer Settings

Available Languages

There are five languages to choose from at the moment. Java, ObjC, CSharp, TypeScript and Python. Specify which language you want to generate in the TargetLanguage setting.

Templates

You must specify a template directory under the TemplatesDirectory Settings. The directory can be a full path or relative to the running directory. The directory must contain a sub directory for each platform you want to generate code for. See the Templates directory for an example.

Template Mapping

You must specify the mapping of T4 Templates to specific SubProcessors for each platform you wish to generate. The TemplateMapping setting is a dictionary of languages and list of templates. Each template must specify :

  • Template, the name of the template without the extensions.
  • SubProcessor The SubProcessor for the template see SubProcessors
  • Type The type of template.
  • Name The format string for the name.

and optionally :

  • Include, a semicolon delimited list of objects to include in the subprocessor.
  • Exclude, a semicolon delimited list of objects to exclude from the subprocessor.
  • Ignore, a semicolon delimited list of objects to ignore from the subprocessor.
  • Matches, a semicolon delimited list of objects to include in the subprocessor.
  • FileCasing, UpperCamel, LowerCamel or Snake for the file casing for the specific file being created.

Note: Many of these optional parameters were used before Vipr had full support for annotations; now that annotations have been added to Vipr usage of these parameters should be limited to legacy scenarios

Example :

{ "Template": "EntityCollectionPage", "SubProcessor": "NavigationCollectionProperty", "Type": "Request", "Name": "<Class><Property>CollectionPage", "Matches" : "includeThisType", "Exclude" : "ExcludedTypeName;OtherExcludedTypeName" }

It is important to understand that subprocessors are mapped to methods that query the OdcmModel and return a set of OData objects. This mapping is maintained in TemplateProcess.InitializeSubprocessor(). The language specific mappings exist in the config directory. Each OData object returned by the subprocessor is applied to the mapped template which results in a code file output per each OData object.

In the above example, the objects in result set of the NavigationCollectionProperty subprocessor will each be applied to the EntityCollectionPage template. Each result will be a code file for each object returned by the NavigationCollectionProperty subprocessor.

SubProcessors

The SubProcessors determine what type of OData object will be passed into the template generating the code file.

  • CollectionMethod All Methods that are of type Collections
  • CollectionProperty Properties that are of type collection
  • CollectionReferenceProperty All Navigation Properties that are of type Collection which are used in Non-Containment Collections
  • ComplexType All Complex types
  • EntityContainer The EntityContainer
  • EntityReferenceType All Entity types which are used in Non-Containment Collections
  • EntityType All Entity types
  • EnumType All Enumerable types
  • MediaEntityType All Media Entity types
  • Method All Actions and Functions
  • MethodWithBody All Methods and Functions that send a body within the http request
  • NavigationCollectionProperty All Navigation Properties that are of type Collection
  • NonCollectionMethod All Methods and Functions that do not return a collection
  • Other The entire model.
  • Property All Properties types
  • StreamProperty All Properties types that return a Streams

Types

The type of template.

  • Request A template that will make a request
  • Model A model
  • Shared A template that will not output any code but is included by other templates
  • Client The template used to create the Client object
  • Other Any other type

Template Name

To set the name of the template using the Name format string. You can insert <Class>, <Property>, <Method>, and <Container> the values will be replaced by the names of the corresponding object. If you insert an item that doesn't exist it will be replaced with an empty string. Note: You can also set the template name from inside the template by : host.SetTemplateName("foo");

Template Editing

The solution contains a non-building project to host the actual T4 templates and make browsing/editing them easier. New template files will be automatically discovered by this project.

Includes/Excludes

There may be specific times when you want to exclude or only process certain objects from the SubProcessor. To Do this you can either set a semicolon delimited list of objects you wanted to include : Include : foo;bar. This will only process objects whose names are foo or bar. The opposite of this is the exclude setting where the SubProcessor will include all objects except for those whose names are in the exclude list, exclude and include can not be used together.

Ignore/Matches

When you can't use the name of an object to include or exclude you can use the long description element on any object. Insert a long description with a semicolon delimited list of strings like : foo;bar;baz. If you add a "Matches" : "foo;baz" only objects who contain foo and baz in their long description will be processed. The opposite is true for Ignore.

Note: You can also check in a template by odcjObject.LongDescriptionContains("foo");

Note: Includes/Excludes and Ignore/Matches were used before Vipr had full support for annotations; now that annotations have been added to Vipr usage of these parameters should be limited to legacy scenarios

Building against Graph Metadata

There are currently several steps we take to form the metadata into one that will successfully generate SDKs in the shape we expect:

  • Remove capability annotations (see #132)
  • Add navigation annotation to thumbnail
    <Annotation String="navigable" Term="Org.OData.Core.V1.LongDescription"/>
  • Remove HasStream properties from onenotePage and onenoteEntityBaseModel
  • Add ContainsTarget="true" to navigation properties that do not have a corresponding EntitySet. This currently applies to navigation properties that contain plannerBucket, plannerTask, plannerPlan, and plannerDelta.
  • Add long descriptions to types and properties from docs

In order to build against metadata other than that stored in the metadata directory, you will need to perform the first four on this list.

Contributing

Before we can accept your pull request, you'll need to electronically complete Microsoft's Contributor License Agreement. If you've done this for other Microsoft projects, then you're already covered.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Why a CLA? (from the FSF)

License

Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license.

msgraph-sdk-code-generator's People

Contributors

andrueastman avatar baywet avatar calebkiage avatar dadheech115 avatar dan-silver avatar deepak2016 avatar dependabot[bot] avatar dianambb avatar garethj-msft avatar ginach avatar iambmelt avatar irvinesunday avatar jaapsingh avatar kevklam avatar michaelmainer avatar mikepizzo avatar muthurathinam avatar muthurathinam-m avatar ndiritu avatar nikithauc avatar nikolaypronchev avatar ramsessanchez avatar revoltek-daniel avatar rkodev avatar samwelkanda avatar shiftylogic avatar silaskenneth avatar thewahome avatar unpluggedk avatar zengin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msgraph-sdk-code-generator's Issues

Non-collection reference properties missing 'add' verb

All platforms: XXXReferenceRequest missing 'add' method corresponding to PUT action
On iOS: Entities (and maybe complex types?) are being generated with property types missing "WithReference" where applicable.

Example property: user.manager (see DirectoryObjectReferenceRequest)

Remove TemplateMapping - Shared

The shared [...] settings for the templates concept has outlived its usefulness. Each template should instead have all of its sub processor mappings in the single language file since they have diverged so much over the evolution of this project.

AB#7096

Support read-only property references

The 'directReports' property on user entities is apparently read-only. I don't think OData has a 'native' way of describing a read-only reference property but maybe something can be hacked in the code generator using a custom annotation in the metadata. Though we've been trying to cut down on those types of things.

This should affect all platforms as it's an issue with the metadata description of the service.

Generation crash on /beta endpoint for commit 171f42329cc79ab8aba99ede7e382c4e394fdb87

https://graph.microsoft.com/beta/$metadata as of today

EntityCollectionReferencesRequest.cs tasks -> com\microsoft\graph\requests\PlanTasksCollectionReferencesRequest.cs
EntityCollectionReferencesRequest.cs buckets -> com\microsoft\graph\requests\PlanBucketsCollectionReferencesRequest.cs

Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at Microsoft.Graph.ODataTemplateWriter.Extensions.OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(OdcmProperty odcmProperty) in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\Extensions\OdcmModelExtensions.cs:line 143 at RuntimeTemplates.EntityCollectionReferencesRequest_cs.GetPostAsyncMethodForReferencesRequest(OdcmProperty odcmProperty) in d:\Temp\MSGraph-SDK-Code-Generator\Templates\CSharp\Base\CollectionRequest.Base.template.tt:line 137 at RuntimeTemplates.EntityCollectionReferencesRequest_cs.TransformText() in d:\Temp\MSGraph-SDK-Code-Generator\Templates\CSharp\Requests\EntityCollectionReferencesRequest.cs.tt:line 20 at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.<>c__DisplayClass53_0.<PreProcessTemplate>b__2(ITextTemplatingEngineHost host) in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 307 at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.ProcessTemplate(ITemplateInfo templateInfo, OdcmObject odcmObject, String fileName) in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 334 at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.ProcessTemplate(ITemplateInfo templateInfo, OdcmObject odcmObject, String className, String propertyName, String methodName, String propertyType) in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 314 at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.<>c__DisplayClass42_0.<ProcessProperties>b__1(OdcmProperty odcmProperty) in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 189 at System.Linq.Enumerable.<>c__DisplayClass7_03.b__0(TSource x)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateWriter.<ProcessTemplates>d__20.MoveNext() in D:\Temp\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateWriter.cs:line 64 at Vipr.FileWriter.Write(IEnumerable1 textFilesToWrite, String outputDirectoryPath) in D:\Temp\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\FileWriter.cs:line 15
at Vipr.Bootstrapper.MetadataToClientSource(String edmxString, String outputDirectoryPath) in D:\Temp\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Bootstrapper.cs:line 118
at Vipr.Bootstrapper.Start(String[] args) in D:\Temp\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Bootstrapper.cs:line 45
at Vipr.Program.Main(String[] args) in D:\Temp\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Program.cs:line 14

Issues attempting to generate Java beta SDK.

I am attempting to use this tool to generate code for a Java Graph SDK with beta models and endpoint builders for testing and POC of a new app. I have run into several different issues attempting to do so.

My process so far has been:

  1. Clone this repository's dev branch.
  2. Clone the https://github.com/microsoftgraph/microsoft-graph-docs repository's master branch.
  3. Build the generator project.
  4. Run Typewriter.exe with references to the docs repository and https://graph.microsoft.com/beta/$metadata

First, I encountered the issue described on this Stack Overflow question. I did note that Visual Studio was unable to find the version of APIDoctor.Publishing specified in the solution. This issue went away by specifying ApiDoctor.Publishing version 1.2.1811.291 and its dependencies.

I then encountered issues with no references I could find on the internet. I think they might have to do with the metadata itself, but I'm clearly not an expert.

program output

Interestingly, this command did complete generation successfully.
Typewriter.exe -v Trace -o "C:\IntuneTest\output" -d "C:\IntuneTest\microsoft-graph-docs" -m "https://graph.microsoft.com/v1.0/$metadata" -g Files -l Java
However I could not figure out what to do with the generated code. I attempted to combine the generated code with the standard java SDK repository using the process mentioned here. I stopped after encountering a variety of compile errors, including syntax errors on the generated classes.

For now. I will assume generation of beta SDKs is not supported, and I should use the behavior described here to access beta endpoints using the standard SDK.

Handle function overloads with same function name and binding parameter

Functions are allowed to appear multiple times in the metadata with the same binding parameter and name as long as they have different parameters. Right now the template logic doesn't handle this as it's currently a single template to a single file during generation. This makes the second instance of a method overwrite the first.

Move all pipelines off of local build agent

Everything under Generation and .NET need to moved off of the Microsoft Graph agent running on the local machine. typewriter.exe updates should now result in a a release where typewriter can be downloaded as an asset.

Everything under .NET and Generation pipelines need to be updated to use the Azure hosted agents.

Downloading typewriter.exe:

  1. https://api.github.com/repos/microsoftgraph/MSGraph-SDK-Code-Generator/releases
  2. Get the first object.
  3. if item[0].assets[0].name == tuypewriter.exe, download at browser_download_url
    AB#7108

&#xA;&#xA; in an annotation breaks the generated output

Repro schema: test_intune_onedf on Graph PPE.

XML snippet in question:

<Annotations Target="microsoft.graph.windows10EndpointProtectionConfiguration/rpcUnauthenticatedClientOptions">
  <Annotation Term="Org.OData.Core.V1.Description" String="This policy setting controls how the RPC server runtime handles unauthenticated RPC clients connecting to RPC servers.&#xA;&#xA;This policy setting impacts all RPC applications. In a domain environment this policy setting should be used with caution as it can impact a wide range of functionality including group policy processing itself.  Reverting a change to this policy setting can require manual intervention on each affected machine.  This policy setting should never be applied to a domain controller." />
</Annotations>

Generated C#:

/// <summary>
/// Gets or sets rpc unauthenticated client options.
/// This policy setting controls how the RPC server runtime handles unauthenticated RPC clients connecting to RPC servers.

This policy setting impacts all RPC applications. In a domain environment this policy setting should be used with caution as it can impact a wide range of functionality including group policy processing itself.  Reverting a change to this policy setting can require manual intervention on each affected machine.  This policy setting should never be applied to a domain controller.
/// </summary>

Create fix for re-ordered parameters

Due to autogeneration of previously manually generated CSDL for the mail API some actions have parameters that are in a different order than previously. In the short term, we need to have Typewriter make this correction.

The following actions had their parameters re-ordered.

Location Name of Edm Element Type of Edm Element Name of Parent Element Error Message
(981, 4) forward Action forward Parameter reordered
(1488, 4) accept Action accept Parameter reordered
(1493, 4) decline Action decline Parameter reordered
(1498, 4) tentativelyAccept Action tentativelyAccept Parameter reordered

The CSDL should look like this.... I think.

<Action Name="forward" IsBound="true">
<Parameter Name="bindingParameter" Type="microsoft.graph.post"/>
<Parameter Name="Comment" Type="Edm.String" Unicode="false"/>
<Parameter Name="ToRecipients" Type="Collection(microsoft.graph.recipient)" Nullable="false"/>
</Action>
<Action Name="accept" IsBound="true">
<Parameter Name="bindingParameter" Type="microsoft.graph.event"/>
<Parameter Name="Comment" Type="Edm.String" Unicode="false"/>
<Parameter Name="SendResponse" Type="Edm.Boolean"/>
</Action>
<Action Name="decline" IsBound="true">
<Parameter Name="bindingParameter" Type="microsoft.graph.event"/>
<Parameter Name="Comment" Type="Edm.String" Unicode="false"/>
<Parameter Name="SendResponse" Type="Edm.Boolean"/>
</Action>
<Action Name="tentativelyAccept" IsBound="true">
<Parameter Name="bindingParameter" Type="microsoft.graph.event"/>
<Parameter Name="Comment" Type="Edm.String" Unicode="false"/>
<Parameter Name="SendResponse" Type="Edm.Boolean"/>
</Action>

Generated Javadoc reporting @return for void methods

Looks like the templates may assume a return type for some void methods - just logging issues as I find them: this is not critical and not a blocker. Happy to take a look myself after I sort out msgraph-sdk-android/issues/10

/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseEventDismissReminderRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseGroupAddFavoriteRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseGroupRemoveFavoriteRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseGroupResetUnseenCountRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseGroupSubscribeByMailRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseGroupUnsubscribeByMailRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/BaseMessageSendRequest.java:63: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseEventDismissReminderRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseGroupAddFavoriteRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseGroupRemoveFavoriteRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseGroupResetUnseenCountRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseGroupSubscribeByMailRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseGroupUnsubscribeByMailRequest.java:41: warning - @return tag cannot be used in method with void return type.
/home/travis/build/microsoftgraph/msgraph-sdk-android/graphsdk/src/main/java/com/microsoft/graph/generated/IBaseMessageSendRequest.java:41: warning - @return tag cannot be used in method with void return type.

2123587

MethodRequestBuilder.cs.tt - fix warning for missing XML comment

Parameters named with the name of a c# keyword are prepended with @ to both the parameter name in the cstor and the XML comments. It shouldn't be in the XML comments. This only affects 2 parameters throwing off 4 compile warnings.

Affects WorkbookFunctionsLogRequestBuilder and WorkbookFunctionsRank_AvgRequestBuilder
AB#7107

DerivedTypeConverter incorrectly applied

https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/dev/Templates/CSharp/Model/ComplexType.cs.tt#L44

if (complex.Derived != null && complex.Base == null)
{
    attributeStringBuilder.Append(Environment.NewLine);
    attributeStringBuilder.Append("    ");
    attributeStringBuilder.Append("[JsonConverter(typeof(DerivedTypeConverter))]");
}

complex.Derived is never null as far as I've observed. It can be an empty list. We should change this check to complex.Derived?.Count > 0
AB#7081

Build fails on dev

Building on commit a680c33 results in a build failure:

src\GraphODataTemplateWriter\Extensions\OdcmModelExtensions.cs(215,27,215,53): error CS1061: 'OdcmSingleton' does not contain a definition for 'NavigationPropertyBindings' and no accessible extension method 'NavigationPropertyBindings' accepting a first argument of type 'OdcmSingleton' could be found (are you missing a using directive or an assembly reference?)

Generator is not respecting Abstract class scenario

<EntityType Name="shiftChangeRequest" BaseType="microsoft.graph.scheduleChangeRequest" Abstract="true">
  <Property Name="recipientActionMessage" Type="Edm.String" />
  <Property Name="recipientActionDateTime" Type="Edm.DateTimeOffset" />
  <Property Name="senderShiftId" Type="Edm.String" />
  <Property Name="recipientUserId" Type="Edm.String" />
</EntityType>

.NET actual

public partial class ShiftChangeRequestObject : ScheduleChangeRequestObject

.NET expected

public abstract partial class ShiftChangeRequestObject : ScheduleChangeRequestObject

PHP actual

class ShiftChangeRequest extends ScheduleChangeRequest

PHP expected

abstract class ShiftChangeRequest extends ScheduleChangeRequest

I suspect the same issue exists in Java and Obj-C. Typescript is not an issue since we generate interface typings.

Is the generated c# code supposed to compile? or just get us some starter code?

Hello all,

i generated the C# code, put it into a c# web api project, but got many errors.

Errors with DerivedTypeConverter, EnumConverter, syntax, etc.

And it takes a long time to include/build/collect-errors.. any advice and tips what we should see and how to use, what's undone and todo for it to be usable, etc.
thx

Actions generation entity binding logic needs work

Currently, our generation logic for request builders doesn't distinguish between a binding to an entity of a type versus a binding to an entity collection of the same type. The concept of binding to an entity collection is not present in the generator and/or VIPR. This means, for the example below, we only generate a GroupEvaluateDynamicMembershipRequestBuilder, and not a GroupCollectionEvaluateDynamicMembershipRequestBuilder, as might be expected. The scenario described here is the first time that an Action binding has been defined for a collection.

image

Binding to collections is implicitly support with the following statements (11.5.5.1 Invoking an Action). The spec doesn't clarify how to handle our scenario as 11.5.5.2 Action Overload Resolution states: "The same action name may be used multiple times within a schema provided there is at most one unbound overload, and each bound overload specifies a different binding parameter type." Both of the overloads we show share the same type, with different parameters, same name, and one is bound to a collection. From 12.2 Action Overloads, "The combination of action name and the binding parameter type MUST be unique within a schema.". This seems to imply that we may need to ask that the action be renamed.

msgraph-sdk-go?

Would it be possible to generate a golang sdk? It would make a great compliment to the existing azure sdk for go.

Incomplete generation for disambiguated entity names

Some entity names end with "Request". In this scenario, we append "Object" to the end so not to confuse or create naming conflicts with our *Request classes.

We aren't generating the proper base class and cstor name in the template.

This affects C# and potentially Java.

This is blocking C# beta generation.

Actual

public partial class ShiftChangeRequestObject : ScheduleChangeRequest
{
    
	///<summary>
	/// The internal ShiftChangeRequest constructor
	///</summary>
    protected internal ShiftChangeRequest()
    {
        // Don't allow initialization of abstract entity types
    }

Expected

public partial class ShiftChangeRequestObject : ScheduleChangeRequestObject
{
    
	///<summary>
	/// The internal ShiftChangeRequestObject constructor
	///</summary>
    protected internal ShiftChangeRequestObject()
    {
        // Don't allow initialization of abstract entity types
    }

src\Microsoft.Graph\Models\Generated\ScheduleChangeRequest.cs(28,28): Error CS1520: Method must have a return type
src\Microsoft.Graph\Models\Generated\ShiftChangeRequest.cs(22,53): Error CS0246: The type or namespace name 'ScheduleChangeRequest' could not be found (are you missing a using directive or an assembly reference?)
src\Microsoft.Graph\Models\Generated\ShiftChangeRequest.cs(28,28): Error CS1520: Method must have a return type
src\Microsoft.Graph\Models\Generated\SwapShiftsChangeRequest.cs(22,58): Error CS0246: The type or namespace name 'ShiftChangeRequest' could not be found (are you missing a using directive or an assembly reference?)
src\Microsoft.Graph\Models\Generated\ScheduleChangeRequest.cs(28,28): Error CS1520: Method must have a return type
src\Microsoft.Graph\Models\Generated\ShiftChangeRequest.cs(22,53): Error CS0246: The type or namespace name 'ScheduleChangeRequest' could not be found (are you missing a using directive or an assembly reference?)
src\Microsoft.Graph\Models\Generated\ShiftChangeRequest.cs(28,28): Error CS1520: Method must have a return type
src\Microsoft.Graph\Models\Generated\SwapShiftsChangeRequest.cs(22,58): Error CS0246: The type or namespace name 'ShiftChangeRequest' could not be found (are you missing a using directive or an assembly reference?)

Investigate whether we support entity reference deletion

From 11.4.6.2 Remove a Reference to an Entity:

A successful DELETE request to the URL that represents a reference to a related entity removes the relationship to that entity.

In OData 4.0, the entity reference to be removed within a collection-valued navigation property is the URL that represents the collection of related references, with the reference to be removed identified by the $id query option. OData 4.01 services additionally support using the URL that represents the reference of the collection member to be removed, identified by key, as described in [OData‑URL].

For single-valued navigation properties, the $id query option MUST NOT be specified.

The DELETE request MUST NOT violate any integrity constraints in the data model.

On successful completion, the response MUST be 204 No Content and contain an empty body.

We have the following metadata:

<EntityType Name="group" BaseType="graph.directoryObject" OpenType="true"
  <NavigationProperty Name="acceptedSenders" Type="Collection(graph.directoryObject)" ContainsTarget="true" />
  <NavigationProperty Name="rejectedSenders" Type="Collection(graph.directoryObject)" ContainsTarget="true" />
</EntityType>

We are certain that the definition is incorrect as the documentation shows this to be a reference when adding an acceptedSender.

For removing a reference, we will need to support:

DELETE /groups/{id}/acceptedSenders/$ref?$id=https://graph.microsoft.com/v1.0/users/{user-id}

@zengin
AB#7084

EntityRequest.cs.tt - duplicate check for AdditionalData response headers

We are generating duplicate checks for response headers and status codes for PATCH scenarios.

        public async System.Threading.Tasks.Task<User> UpdateAsync(User userToUpdate, CancellationToken cancellationToken)
        {
			if (userToUpdate.AdditionalData != null)
			{
				if (userToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
					userToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
				{
					throw new ClientException(
						new Error
						{
							Code = GeneratedErrorConstants.Codes.NotAllowed,
							Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, userToUpdate.GetType().Name)
						});
				}
			}
            if (userToUpdate.AdditionalData != null)
            {
                if (userToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    userToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                        new Error
                        {
                            Code = GeneratedErrorConstants.Codes.NotAllowed,
                            Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, userToUpdate.GetType().Name)
                        });
                }
            }
            this.ContentType = "application/json";
            this.Method = "PATCH";
            var updatedEntity = await this.SendAsync<User>(userToUpdate, cancellationToken).ConfigureAwait(false);
            this.InitializeCollectionProperties(updatedEntity);
            return updatedEntity;
        }

AB#7106

XML comments within code comments are not correct in c#

Annotation:

<Annotations Target="microsoft.graph.cloudCommunications/calls">
  <Annotation Term="Org.OData.Core.V1.Description" String="Gets or sets the list of &lt;see cref=&quot;T:Microsoft.Graph.Call&quot; /&gt; for this application." />
</Annotations>

Expected code comment:

/// <summary>
/// Gets or sets the list of <see cref="T:Microsoft.Graph.Call" /> for this application.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "calls", Required = Newtonsoft.Json.Required.Default)]
public ICloudCommunicationsCallsCollectionPage Calls { get; set; }

Current code comment:

/// <summary>
/// Gets or sets calls.
/// Gets or sets the list of &amp;lt;see cref="T:Microsoft.Graph.Call" /&amp;gt; for this application.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "calls", Required = Newtonsoft.Json.Required.Default)]
public ICallsApplicationCallsCollectionPage Calls { get; set; }

AB#7105

ItemWithPath not appending an item path for NextPageRequest

This calls contains the correct URL structure:

var path = "Community Service";
var driveItemsPage = await graphClient.Me.Drive.Root.ItemWithPath(path).Children.Request().Top(1).GetAsync(); 
// https://graph.microsoft.com/v1.0/me/drive/root:/Community%20Service:/children?$top=1

This call does not issue the correct URL. Notice that ":/Community%20Service:" segment is missing.

driveItemsPage = await driveItemsPage.NextPageRequest.GetAsync();
// Actual
// https://graph.microsoft.com/v1.0/me/drive/root/children?$top=1&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_FileRef%3dpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service%252fBook%252exlsx%26p_ID%3d390%26RootFolder%3d%252fpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service
// Expected
// https://graph.microsoft.com/v1.0/me/drive/root:/Community%20Service:/children?$top=1&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_FileRef%3dpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service%252fBook%252exlsx%26p_ID%3d390%26RootFolder%3d%252fpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service

This call does issue the correct URL:

driveItemsPage = await graphClient.Me.Drive.Root.ItemWithPath(path).Children
                              .Request(driveItemsPage.NextPageRequest.QueryOptions)
                              .GetAsync();

If we don't use the root segment, and use the items collection, the NextPageRequest works as expected.

                var driveItemsPage = await graphClient.Me.Drive.Items["015U5LKCS34Q6NKSEKZVDZMNVKDTXJ4CUR"].Children.Request().Top(1).GetAsync();
                driveItems.AddRange(driveItemsPage.CurrentPage);

                while (driveItemsPage.NextPageRequest != null)
                {
                    driveItemsPage = await driveItemsPage.NextPageRequest.GetAsync();
                    driveItems.AddRange(driveItemsPage.CurrentPage);
                }

Reported in microsoftgraph/msgraph-sdk-dotnet#54.

Add Request methods that take a body but don't actually make the call

In order to support creating Batch requests that contain request bodies, we need to be able to have methods that set the HTTP method and content, without actually making the HTTP call.
e.g. when a request has a PostAsync(body) method, it should also have a AsPost(body) that returns the Request object.
I'm open to discuss the new method naming.
AB#6084

Generation crash on /beta endpoint for commit b2dd0fc3c9af75022b59ee5bec82f6b686f387d7

vipr https://graph.microsoft.com/v1.0/$metadata --writer="GraphODataTemplateWriter"

works a-ok

vipr https://graph.microsoft.com/beta/$metadata --writer="GraphODataTemplateWriter"

crashes with (I only kept the last working and the crashing line)

IEntityRequest.cs subscription -> com\microsoft\graph\requests\ISubscriptionRequest.cs
IEntityRequest.cs identityRiskEvent -> com\microsoft\graph\requests\IIdentityRiskEventRequest.cs

Unhandled Exception: System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at Vipr.Core.CodeModel.OdcmProjection.FindCapability[T](String term, OdcmObject odcmObject) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr.Core\CodeModel\OdcmProjection.cs:line 206
at Vipr.Core.CodeModel.OdcmProjection.BooleanValueOf(String term, OdcmObject odcmObject) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr.Core\CodeModel\OdcmProjection.cs:line 125
at Vipr.Core.CodeModel.OdcmProjection.Supports(String term, OdcmObject odcmObject) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr.Core\CodeModel\OdcmProjection.cs:line 151
at Vipr.Core.CodeModel.OdcmProjection.SupportsExpand() in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr.Core\CodeModel\OdcmProjection.cs:line 181
at Microsoft.Graph.ODataTemplateWriter.Extensions.Features.get_CanExpand() in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\Extensions\FeatureExtensions.cs:line 17
at RuntimeTemplates.IEntityRequest_cs.TransformText() in d:\home\MSGraph-SDK-Code-Generator\Templates\CSharp\Requests\IEntityRequest.cs.tt:line 47
at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.<>c__DisplayClass53_0.b__2(ITextTemplatingEngineHost host) in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 306
at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.ProcessTemplate(ITemplateInfo templateInfo, OdcmObject odcmObject, String fileName) in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 333
at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.ProcessTemplate(ITemplateInfo templateInfo, OdcmObject odcmObject, String className, String propertyName, String methodName, String propertyType) in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 313
at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateProcessor.<>c__DisplayClass41_0.b__0(OdcmObject odcmType) in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateProcessor.cs:line 182
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at Microsoft.Graph.ODataTemplateWriter.TemplateProcessor.TemplateWriter.<ProcessTemplates>d__20.MoveNext() in D:\home\MSGraph-SDK-Code-Generator\src\GraphODataTemplateWriter\TemplateProcessor\TemplateWriter.cs:line 64 at Vipr.FileWriter.Write(IEnumerable1 textFilesToWrite, String outputDirectoryPath) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\FileWriter.cs:line 15
at Vipr.Bootstrapper.MetadataToClientSource(String edmxString, String outputDirectoryPath) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Bootstrapper.cs:line 118
at Vipr.Bootstrapper.Start(String[] args) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Bootstrapper.cs:line 45
at Vipr.Program.Main(String[] args) in D:\home\MSGraph-SDK-Code-Generator\submodules\vipr\src\Core\Vipr\Program.cs:line 14

Generation on /beta endpoint doesn't work

Previous issue #89 dated 5/23

It still crashes on the /beta endpoint. How am I supposed to build me a custom Microsoft.Graph for the /beta endpoint if the prerequisite is not up to the job? Nobody else trying to build that?
AB#7097

Mismatch in MS Graph SDK with MS Graph REST API for RevokeSignInSessions endpoint

Describe the bug
The MS Graph SDK has a mismatch on the response schema it expects vs what the MS Graph REST API returns for the "RevokeSignInSessions" endpoint.

The IUserRevokeSignInSessionsRequest.PostAsync returns a Task but the API response payload wraps that bool in a complex object and the SDK fails to deserialize.

The API states just a boolean should be returned - https://docs.microsoft.com/en-us/graph/api/user-revokesigninsessions?view=graph-rest-1.0&tabs=http

To Reproduce
Steps to reproduce the behavior:

  1. Create an AAD application with the Directory.ReadWrite.All application permission
  2. Create a .NET Core console application using the MS Graph SDK version 1.21.0
            IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
                .Create("{enter client_id}")
                .WithClientSecret("{enter client_secret}")
                .Build();

            ClientCredentialProvider authenticationProvider = new ClientCredentialProvider(confidentialClientApplication);

            GraphServiceClient graphServiceClient = new GraphServiceClient(authenticationProvider);
            var result = await graphServiceClient
                .Users["{enter user_id}"]
                .RevokeSignInSessions()
                .Request()
                .PostAsync();

Actual Results

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Edm.Null",
    "@odata.null": true
}

Expected behavior
The successful request should correctly deserialize the response and not error out.

Screenshots
Error message differes b/w .NET Framework 4.8 and .NET Core. In .NET Core the error is:

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=Unexpected character encountered while parsing value: {. Path '', line 1, position 1.
  Source=Newtonsoft.Json
  StackTrace:
   at Newtonsoft.Json.JsonTextReader.ReadAsBoolean()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Microsoft.Graph.Serializer.DeserializeObject[T](String inputString)
   at Microsoft.Graph.ResponseHandler.<HandleResponse>d__2`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.Graph.BaseRequest.<SendAsync>d__31`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AzureAdGraphNetCoreSample.Program.<CallUsingCreateClientCredentialProvider>d__1.MoveNext() in C:\Users\lapellan\source\repos\AzureAdGraphSample\AzureAdGraphNetCoreSample\Program.cs:line 34
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at AzureAdGraphNetCoreSample.Program.Main(String[] args) in C:\Users\lapellan\source\repos\AzureAdGraphSample\AzureAdGraphNetCoreSample\Program.cs:line 17

Desktop (please complete the following information):

Additional context

Building without Visual Studio (Mono?)

I'm not a Windows user and want to be able to build and test the project (generate Java classes) from the command line on Linux. I tried with mono_build.sh on a fresh Linux instance on AWS and failed. I don't have access to the error messages now. As the SDKs built by this project are destined for numerous platforms including non-Windows platforms I'd like to see support for building and generating SDKs on Linux (tested documentation). Without that users without Visual Studio will not contribute.

Beta version code does not build

I am trying to generate beta version code and build it to generate the dlls. The generated code does not build for me. The metadata file I am using beta_2018_09_14_descriptions.xml.
The error I get while try to build

  1. it missing some class such as BaseClient.cs HttpProvider.cs Serializer.cs etc
  2. After I add all these missing class it complain about AndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionReferencesRequest did not implement the interface method.

Could you give suggestions which metadata file to use to generate a beta version of code that can build or any steps I am missing.

Thanks a lot.

New-MgUser fails 'does not exist or one of its queried reference-property objects are not present.'

When creating a new user with New-MgUser, if not all of the required parameters are passed it throws a rather cryptic error:

Resource 'User_<guid>' does not exist or one of its queried reference-property objects are not present.

I found that this happened because I wasn't passing a MailNickname parameter. After also passing that parameter, it created the user as expected.

For anyone else that runs into this, here are the required parameters.

It would be great if the module returned a better error or had required parameters so it was clear in the cmdlet's help. I'm sure this has or will come up in other cmdlets.
AB#7085

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.