Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
svrooij opened this issue Jan 28, 2024 · 3 comments
Labels

Comments

@svrooij
Copy link
Contributor

svrooij commented Jan 28, 2024

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

Related missing paths:

  • deviceAppManagement/mobileApps/{appId}/microsoft.graph.win32LobApp/contentVersions
  • deviceAppManagement/mobileApps/{appId}/microsoft.graph.win32LobApp/contentVersions/{contentVersionId}/files
  • deviceAppManagement/mobileApps/{appId}/microsoft.graph.win32LobApp/contentVersions/{contentVersionId}/files/{fileId}
  • deviceAppManagement/mobileApps/{appId}/microsoft.graph.win32LobApp/contentVersions/{contentVersionId}/files/{fileId}/commit

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
Copy link
Contributor

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

@svrooij
Copy link
Contributor Author

svrooij commented Jan 29, 2024

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

@svrooij
Copy link
Contributor Author

svrooij commented Jan 31, 2024

Might be related to #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants