microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Error when specifying Application.Api properties #12

Open FoxyNE opened 4 years ago

FoxyNE commented 4 years ago

I am using Microsoft.Graph NuGet package v1.20.0 and can successfully create an AAD Application using graphServiceClient.Applications.Request().AddAsync(application) but as soon as I try to specify the Api property, as shown below, I get the following error:

Microsoft.Graph.ServiceException: 'Code: Request_BadRequest Message: A type named 'Microsoft.DirectoryServices.apiApplication' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.

Code snippet:

var application = new Application
            {                
                Api = new ApiApplication
                {
                    Oauth2PermissionScopes = new List<PermissionScope>
                    {
                        new PermissionScope
                        {
                            Id = scopeId,
                            IsEnabled = true,
                            Type = "Admin",
                            Value = scopeValue
                        }
                    },
                    PreAuthorizedApplications = new List<PreAuthorizedApplication>
                    {
                        new PreAuthorizedApplication
                        {
                            AppId = app1Id,
                            DelegatedPermissionIds = new List<string>
                            {
                                scopeId.ToString()
                            }
                        },
                        new PreAuthorizedApplication
                        {
                            AppId = app2Id,
                            DelegatedPermissionIds = new List<string>
                            {
                                scopeId.ToString()
                            }
                        }
                    },
                    RequestedAccessTokenVersion = 2
                },
                DisplayName = displayName,
                SignInAudience = "AzureADMyOrg"
            }

await graphServiceClient.Applications.Request().AddAsync(application)

I've also tried this with an existing Application using await graphServiceClient.Applications[existingApp.Id].Request().UpdateAsync(application);

Expected behavior Application's API changes are persisted and visible in the App's manifest in the Portal.

MIchaelMainer commented 4 years ago

Thank you for opening this issue. Can you show us a sanitized request and response?

Abhi-Sh1 commented 4 years ago

facing same issue while updating RequiredResourceAccess property. Any timelines for this to be released?

vsaroopchand commented 4 years ago

Can we get an update on this issue please. This is blocking our migration from Azure AD SDK to MS Graph SDK due to performance, etc.

darrelmiller commented 4 years ago

@vsaroopchand If you could show us the request body that is being sent, that would really help us troubleshoot this issue. Using fiddler is the easiest way to capture that.

vsaroopchand commented 4 years ago

@darrelmiller I emailed you a complete fiddler trace of the issue.

MIchaelMainer commented 4 years ago

The service is not ignoring the odata.type property. It is supposed to ignore odata.type instance annotation if it doesn't expect it. We set it by default on all objects.

A preliminary run of this code tells me that Application.Odatatype and ApplicationApi.Odatatype can be set to null to address this. You may need to set other objects' odatatype property to null to get around this issue.

vsaroopchand commented 4 years ago

Thanks for the response Michael. Our use case requires us to set these properties to avoid manually editing the manifest. We look forward to a long-term fix that allows these properties via the SDK.

xamarsinx commented 4 years ago

The issue has been fixed.

MIchaelMainer commented 4 years ago

@FoxyNE are you seeing this as fixed?

petrhollayms commented 6 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.