MSGraph-SDK-Code-Generator icon indicating copy to clipboard operation
MSGraph-SDK-Code-Generator copied to clipboard

Add/Remove methods are not implemented on collections

Open zengin opened this issue 5 years ago • 9 comments
trafficstars

Metadata has add and remove actions defined on a collection of microsoft.graph.site. It looks like we don't support generating methods for actions defined on collections.

<Action Name="add" IsBound="true">
<Parameter Name="bindingParameter" Type="Collection(graph.site)"/>
<Parameter Name="value" Type="Collection(graph.site)"/>
<ReturnType Type="Collection(graph.site)"/>
</Action>

<Action Name="remove" IsBound="true">
<Parameter Name="bindingParameter" Type="Collection(graph.site)"/>
<Parameter Name="value" Type="Collection(graph.site)"/>
<ReturnType Type="Collection(graph.site)"/>
</Action>

Example Requests: https://docs.microsoft.com/en-us/graph/api/site-follow?view=graph-rest-1.0&tabs=csharp#request https://docs.microsoft.com/en-us/graph/api/site-unfollow?view=graph-rest-1.0&tabs=csharp#request AB#7086

zengin avatar Jun 12 '20 03:06 zengin

This needs to be supported on non-contained entities. <NavigationProperty Name="followedSites" Type="Collection(graph.site)" />

MIchaelMainer avatar Jun 12 '20 03:06 MIchaelMainer

Note: java is also impacted by this

baywet avatar Oct 30 '20 17:10 baywet

More specifically, we don't support generating methods for actions defined on reference collections. It is generated for await client.Sites[""].Sites.Add(new List<Site>()).Request().PostAsync() in .NET.

Reference collection where containsTarget = false (default)

  <EntityType Name="user" BaseType="graph.directoryObject" OpenType="true">
    <NavigationProperty Name="followedSites" Type="Collection(graph.site)" />
  </EntityType>

MIchaelMainer avatar Oct 30 '20 21:10 MIchaelMainer

We need to figure out someway to identify whether these methods are actually implemented by the service on the reference collections.

darrelmiller avatar Jan 18 '21 13:01 darrelmiller

@darrelmiller I confirmed that remove works even though it throws 207 with a general exception. A subsequent GET query returned a set which doesn't contain the removed item.

add also works properly with a 200.

We already have a way of adding references but it requires one call per reference whereas these add/remove actions allow multiple references in a single call.

zengin avatar Jan 19 '21 22:01 zengin

double checking we're not missing something in Java at this moment:

  • only 1 remove method present for sites
  • 6 add methods present for Excel things and 1 for sites

Should there be more?

baywet avatar Jan 20 '21 13:01 baywet

@baywet, please refer to the example requests mentioned in the initial issue description for scope. If add/remove for followed sites in Java is working similar to the HTTP sample, we should be good.

zengin avatar Jan 20 '21 15:01 zengin

thanks, it looks to be on part. I also looked at the metadata and the numbers match what I was sharing. Removing the java tag.

baywet avatar Jan 20 '21 17:01 baywet

reviewing from the kiota checklist: kiota solves that issue for us

baywet avatar Nov 17 '21 19:11 baywet

closing since C# is now using kiota and it's been addressed there

baywet avatar Nov 27 '23 14:11 baywet