【问题标题】:GraphServiceClient, Create ContentVersions to intune with GraphServiceClientGraphServiceClient,创建 ContentVersions 以使用 GraphServiceClient
【发布时间】:2020-03-03 21:13:54
【问题描述】:

我在创建新的 ContentVersion 时遇到问题 - 现在我已使用此代码创建了一个新条目。

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

但我找不到创建新 ContentVersion 的方法。我知道 URL,但不知道要调用的方法。 要调用的 URL 是这样的

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

到目前为止,我已经尝试克隆 github 项目 (https://github.com/microsoftgraph/msgraph-beta-sdk-dotnet) 以查看它是如何工作的,但没有运气。而现在,我只是不知道去哪里找。

任何帮助将不胜感激

【问题讨论】:

    标签: c# .net-core microsoft-graph-api


    【解决方案1】:

    好的,我就是这样解决的

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

    不确定这是否是正确的做法,但它有效!

    【讨论】:

      【解决方案2】:

      字符串连接少一点的替代解决方案:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-03-19
        • 2022-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-06
        • 2019-09-05
        相关资源
        最近更新 更多