msgraph-sdk-dotnet
msgraph-sdk-dotnet copied to clipboard
Missing Post method path for /children
how can we do that with SDK v5.0.0 ?
var driveItem = new DriveItem
{
Name = path,
Folder = new Folder(),
AdditionalData = new Dictionary<string, object>() { { "@microsoft.graph.conflictBehavior", "fail" } }
};
await graphClient.Sites[siteId].Drives[driveId].Root.Children.Request().AddAsync(driveItem);
Originally posted by @amarmechai in https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1290#issuecomment-1277775527
https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/feature/5.0/src/Microsoft.Graph/Generated/Drives/Item/Root/Children/ChildrenRequestBuilder.cs#L85
Children request builder missing a Post method and will need to be fixed in the metadata.
This can be worked around by the snippet below as the metadata is fixed
var driveItem = new DriveItem
{
Name = "path",
Folder = new Folder(),
AdditionalData = new Dictionary<string, object>() { { "@microsoft.graph.conflictBehavior", "fail" } }
};
var requestInformation = graphServiceClient.Drives["driveId"].Root.Children.CreateGetRequestInformation();
requestInformation.HttpMethod = Method.POST;
requestInformation.SetContentFromParsable(graphServiceClient.RequestAdapter, "application/json", driveItem);
await graphServiceClient.RequestAdapter.SendAsync<Drive>(requestInformation, Drive.CreateFromDiscriminatorValue);
https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/feature/5.0/src/Microsoft.Graph/Generated/Drives/Item/Root/Children/ChildrenRequestBuilder.cs#L85
Children request builder missing a Post method and will need to be fixed in the metadata.
This can be worked around by the snippet below as the metadata is fixed
var driveItem = new DriveItem { Name = "path", Folder = new Folder(), AdditionalData = new Dictionary<string, object>() { { "@microsoft.graph.conflictBehavior", "fail" } } }; var requestInformation = graphServiceClient.Drives["driveId"].Root.Children.CreateGetRequestInformation(); requestInformation.HttpMethod = Method.POST; requestInformation.SetContentFromParsable(graphServiceClient.RequestAdapter, "application/json", driveItem); await graphServiceClient.RequestAdapter.SendAsync<Drive>(requestInformation, Drive.CreateFromDiscriminatorValue);
I tested this snippet of code and can confirm that this workaround functions correctly...
Closed via https://github.com/microsoftgraph/msgraph-sdk-dotnet/pull/1639 and https://github.com/microsoftgraph/msgraph-metadata/issues/248