lab icon indicating copy to clipboard operation
lab copied to clipboard

"Adding OData Connected Service to the project failed: Unable to cast object of type 'Microsoft.OData.Edm.Library.AmbiguousTypeBinding' to type 'Microsoft.OData.Edm.IEdmCollectionType'."

Open BrainSlugs83 opened this issue 7 years ago • 8 comments

Using the Add-in with VS2017 -- trying to add a connected OData service for the beta version of Microsoft Graph (https://graph.microsoft.com/beta/$metadata), and I end up with this:

Adding Nuget Packages
Generating Client Proxy ...
Error:Adding OData Connected Service to the project failed: Unable to cast object of type 'Microsoft.OData.Edm.Library.AmbiguousTypeBinding' to type 'Microsoft.OData.Edm.IEdmCollectionType'.

Trying to do it with T4 templates gives the same error.

BrainSlugs83 avatar Nov 17 '17 20:11 BrainSlugs83

I am experiencing exactly the same problem. Has anyone found a solution for this?

mattskel avatar Nov 27 '17 00:11 mattskel

Any news? -- This is kind of a blocking bug that is preventing folks from using the tool.

BrainSlugs83 avatar Dec 08 '17 01:12 BrainSlugs83

Any updates on this? it is affecting us to generate proxy for consuming D365 for operation Odata endpoints.

rizworks avatar Jan 17 '18 03:01 rizworks

I also have same problem.

qazsen avatar Jan 23 '18 22:01 qazsen

Is there any solution for this error.?

As one of the way to create a file and reference to that file doesn't work. there is reference among the entities so we cannot identify what to remove and what to keep.

dcs-kartik avatar Feb 01 '18 11:02 dcs-kartik

Hi All,

Even I`m getting the same error message. Please provide a solution for this.

Regards,

zameer218 avatar Jul 02 '18 04:07 zameer218

There is a code delta between the Connected Services extension and the actively developed Client Code Gen extension; the state of the Connected Services extension is under review. A workaround for now is to use the Client Code Gen extension to help generate the proxy code against https://graph.microsoft.com/beta/$metadata.

One can accomplish this by installing the extension from above and then

  1. In your project that needs reference to the MSGraph entities, right-click on the project in Solution Explorer and go to Add->New Item.
  2. There should be an option for OData Client. Name your .tt file as appropriate. image
  3. A .tt file should be added to your project. Double-click on it in the Solution Explorer to open it. Add "https://graph.microsoft.com/beta/$metadata" into the MetadataDocumentUri field (it should read public const string MetadataDocumentUri = "https://graph.microsoft.com/beta/$metadata";). Then hit Ctrl+S to save the file and your proxy should be generated. Sample below: image

Also attached my generated file. ProxyForMSGraphBeta.zip

AlanWong-MS avatar Jul 02 '18 18:07 AlanWong-MS

Now it works great in Unchase OData ConnectedService v.1.1.2. Check it.

unchase avatar Apr 15 '19 10:04 unchase