microsoftgraph / msgraph-metadata

Microsoft Graph metadata captured and used for generating client library code files.
https://graph.microsoft.com
MIT License
99 stars 28 forks source link

Commit Win32LobApp missing `deviceAppManagement/mobileApps/{id}/microsoft.graph.win32LobApp/contentVersions/{contentVersionId}/files/{fileId}/commit` #565

Open svrooij opened 7 months ago

svrooij commented 7 months ago

There is absolutely no documentation on how to commit a file once uploaded.

Related missing paths:

Working solution for other facing this issue

Here is my Graph SDK .NET hack extension method (as part of WinTuner):

    public static Task Intune_CommitWin32LobAppContentVersionFileAsync(this GraphServiceClient graphServiceClient, string win32LobAppId, string contentVersionId, string mobileAppContentFileId, FileEncryptionInfo fileEncryptionInfo, CancellationToken cancellationToken = default)
    {
        ArgumentNullException.ThrowIfNull(graphServiceClient);
        ArgumentException.ThrowIfNullOrEmpty(win32LobAppId);
        ArgumentException.ThrowIfNullOrEmpty(contentVersionId);
        ArgumentException.ThrowIfNullOrEmpty(mobileAppContentFileId);
        ArgumentNullException.ThrowIfNull(fileEncryptionInfo);
        var body = new MobileAppContentFileCommitBody
        {
            FileEncryptionInfo = fileEncryptionInfo,
        };
        var data = JsonSerializer.SerializeToUtf8Bytes(body, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
        var requestInfo = new RequestInformation
        {
            HttpMethod = Method.POST,
            Content = new MemoryStream(data),
            URI = new Uri($"https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/{win32LobAppId}/microsoft.graph.win32LobApp/contentVersions/{contentVersionId}/files/{mobileAppContentFileId}/commit"),
        };
        requestInfo.Headers.Add("Content-Type", "application/json");
        return graphServiceClient.RequestAdapter.SendNoContentAsync(requestInfo, errorMapping: ErrorMapping, cancellationToken: cancellationToken);
    }

This issue is related to #510 as in things missing in the app management stuff.

irvinesunday commented 7 months ago

Where are these paths missing from? These paths are available in the the OpenAPI file.

svrooij commented 7 months ago

@irvinesunday From the docs and from the graph sdk in dotnet

svrooij commented 7 months ago

Might be related to #179