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

Create RequestBuilders for structural properties that need to be accessed directly

Open darrelmiller opened this issue 4 years ago • 1 comments

e.g. mailboxsettings

and

https://graph.microsoft.com/beta/print/printers/{id}/jobs/{id}/configuration

Currently we don't know when this is possible and instead of generating RequestBuilders for every structural property we don't generate any. We should use a capability annotation to indicate that support is required. AB#7626

darrelmiller avatar Jan 16 '21 02:01 darrelmiller

Would we want to support accessing arbitrary structural properties as the API supports this? I can't think of any reason other than slightly simplifying the scenario to update a single property in .NET.

For example, I can do the following:

GET https://graph.microsoft.com/v1.0/me/jobtitle
PATCH https://graph.microsoft.com/v1.0/me/jobtitle

{
  "value":"Marketing Director2"
}

Instead of doing:

GET https://graph.microsoft.com/v1.0/me?$select=jobtitle
PATCH https://graph.microsoft.com/v1.0/me/jobtitle

{
  "jobTitle":"Marketing Director3"
}

We could enable scenarios like these for .NET:

// Get the type parameter for the property when the property is specified.
client.Me.GetProperty(u => u.MailboxSettings).Request().GetAsync<MailboxSettings>();
// Don't need to new up an object to update a single property.
client.Me.SetProperty(u => u.JobTitle, "Marketing Director2").Request().UpdateAsync();

MIchaelMainer avatar Jan 22 '21 23:01 MIchaelMainer

closing since this is now supported by the conversion library and kiota https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/e3d59b67608b7496804ff007f2b2da59ce22bd2e/src/Microsoft.Graph/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.cs#L12

baywet avatar Nov 27 '23 14:11 baywet