0
votes

I'm having trouble creating a new ContentVersion - Right now I have created a new entry with this code.

var newItem = await client.DeviceAppManagement.MobileApps.Request().AddAsync(new Win32LobApp {});

But I can't find the method to create a new ContentVersion. I know the URL, but not the method to call. The URL to call is this

POST: https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/{0}/microsoft.graph.win32LobApp/contentVersions

So far I have tried to clone the github project (https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet) to see how it works, but without luck. And right now, I just don't know where to look.

Any help would be appreciated

2

2 Answers

1
votes

Okay, I solved it by doing it like this

ManagedMobileLobAppRequestBuilder builder = new ManagedMobileLobAppRequestBuilder($"{client.BaseUrl}/deviceAppManagement/mobileApps/{newItem.Id}/{newItem.ODataType.Substring(1)}", client);
var result = await builder.ContentVersions.Request().AddAsync(new MobileAppContent());

Not sure if this is the correct way of doing it, but it works!

0
votes

An alternative solution with a little less string concatenation:

var lobType = createAppResult.ODataType.Substring(1);
var baseUrl = client.DeviceAppManagement.MobileApps[appId].AppendSegmentToRequestUrl(lobType)
var lobRequestBuilder = new ManagedMobileLobAppRequestBuilder(baseUrl, client);