msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

Add support to access structural properties

Open MIchaelMainer opened this issue 7 years ago • 5 comments

  • [x] Expected behavior.
  • [x] Actual behavior.
  • [x] Steps to reproduce the behavior.

Expected behavior

https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/site_get The request builders provide a mechanism to build a URL to directly access individual structural properties on an entity. This mechanism would ideally provide information to get back a strongly typed entity in the case the the structural property represents an enum, entity, or complex type.

Note - Generating request builders for each structural property is no-op; we would generate a lot of code to support a lot of functionality that would rarely be used.

Actual behavior

You can't build a URL to structural properties with our current request builders. You can use select query parameters to get the properties. While the select statement is sufficient in a vast majority of cases, there are some cases where this won't work. MailboxSettings is one area where the setter requires a resource URL to the structural property. 450905

Steps to reproduce the behavior

Try to access to GraphServiceClient.Sites.Root using the request builder. Root doesn't existing for creating a request builder to that property.

AB#7343

MIchaelMainer avatar Apr 16 '18 17:04 MIchaelMainer

Related microsoftgraph/microsoft-graph-docs#673

MIchaelMainer avatar Apr 20 '20 20:04 MIchaelMainer

@MIchaelMainer, Is there a timeline when this issue will be fixed?

kshumon2000 avatar Jul 06 '20 03:07 kshumon2000

@baywet, this is a new one for the kiota checklist. Is this resolved by kiota?

zengin avatar Nov 19 '21 01:11 zengin

For this specific example GET /sites/root, I believe it's a metadata issue at it's core. There's no root singleton, function or anything defined under the "sites" Collection(sitecollection). ODSP is basically "cheating" here by using a "magic id" in the collection. client.Sites["root"] should technically work with the current and future SDKs. There are root properties on shareddriveitem, sitecollection, site, drive, driveitem, but I don't think this is what's being discussed here.

baywet avatar Nov 19 '21 13:11 baywet

Based on the following comment, it looks like we need an additional signal from the metadata.

https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/2833 @darrelmiller:

This isn't a doc issue. This is an SDK issue. In OData, structural properties can also be addressed using a path segment. They do not need to be a navigation property. Our challenge with the SDKs is how do we know which structural properties are actually exposed explicitly by the API. We need additional metadata to know when to generate the request builder.

zengin avatar Nov 19 '21 18:11 zengin