Umer Qureshi
Umer Qureshi

Reputation: 1766

Azure AD Graph Request in WebAPI2

Recently created WebAPI2 web-service to get list of all active Directory Applications and User. on Local IIS List of Application and Users will be fetched using Azure AD Graph API without any problem.

When deploy webAPI2 on Azure as a resource. List of Users will be fetched as expected but list of Application which is fetched using following code throws error.

Call to get List of Applications:

IPagedCollection<IApplication> applications= await activeDirectoryClient.Applications.ExecuteAsync(); 

Error Stack

System.ArgumentNullException: Value cannot be null. Parameter name: type at Microsoft.Data.Edm.EdmUtil.CheckArgumentNull[T](T value, String parameterName) at Microsoft.Data.Edm.EdmTypeSemantics.AsComplex(IEdmTypeReference type) at Microsoft.Data.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadNonEntityValueImplementation(String payloadTypeName, IEdmTypeReference expectedTypeReference, DuplicatePropertyNamesChecker duplicatePropertyNamesChecker, CollectionWithoutExpectedTypeValidator collectionValidator, Boolean validateNullValue, Boolean isTopLevelPropertyValue, Boolean insideComplexValue, String propertyName, Boolean readRawValueEvenIfNoTypeFound) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadOpenProperty(IODataJsonLightReaderEntryState entryState, String propertyName, Boolean propertyWithValue) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderEntryState entryState, String propertyName, Boolean propertyWithValue) at Microsoft.Data.OData.JsonLight.ODataJsonLightEntryAndFeedDeserializer.ReadEntryPropertyWithValue(IODataJsonLightReaderEntryState entryState, String propertyName)

Application Flow:

My Web Application Let say A call WebAPI B to get list of Users and Applications. Application type of webAPI is native and i'm using UserPasswordCredential and AcquireTokenAsync to get access token.

Upvotes: 2

Views: 191

Answers (1)

eicthecat
eicthecat

Reputation: 1

I have the same issue (Microsoft.Data.Edm.EdmUtil.CheckArgumentNull[...) from time to time when publishing something that has nothing to do with Azure. I guess this is a compilation problem (sometimes it works, sometimes not :-))... clean and publish do the job (unfortunatly)

Upvotes: 0

Related Questions