POST https://graph.microsoft.com/v1.0/deviceAppManagement/managedEBooks/{managedEBookId}/assign
Content-type: application/json
Content-length: 312
{
"managedEBookAssignments": [
{
"@odata.type": "#microsoft.graph.managedEBookAssignment",
"id": "ae8b0d27-0d27-ae8b-270d-8bae270d8bae",
"target": {
"@odata.type": "microsoft.graph.allLicensedUsersAssignmentTarget"
},
"installIntent": "required"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.DeviceAppManagement.ManagedEBooks.Item.Assign;
using Microsoft.Graph.Models;
var requestBody = new AssignPostRequestBody
{
ManagedEBookAssignments = new List<ManagedEBookAssignment>
{
new ManagedEBookAssignment
{
OdataType = "#microsoft.graph.managedEBookAssignment",
Id = "ae8b0d27-0d27-ae8b-270d-8bae270d8bae",
Target = new AllLicensedUsersAssignmentTarget
{
OdataType = "microsoft.graph.allLicensedUsersAssignmentTarget",
},
InstallIntent = InstallIntent.Required,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.DeviceAppManagement.ManagedEBooks["{managedEBook-id}"].Assign.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc device-app-management managed-ebooks assign post --managed-ebook-id {managedEBook-id} --body '{\
"managedEBookAssignments": [\
{\
"@odata.type": "#microsoft.graph.managedEBookAssignment",\
"id": "ae8b0d27-0d27-ae8b-270d-8bae270d8bae",\
"target": {\
"@odata.type": "microsoft.graph.allLicensedUsersAssignmentTarget"\
},\
"installIntent": "required"\
}\
]\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphdeviceappmanagement "github.com/microsoftgraph/msgraph-sdk-go/deviceappmanagement"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphdeviceappmanagement.NewAssignPostRequestBody()
managedEBookAssignment := graphmodels.NewManagedEBookAssignment()
id := "ae8b0d27-0d27-ae8b-270d-8bae270d8bae"
managedEBookAssignment.SetId(&id)
target := graphmodels.NewAllLicensedUsersAssignmentTarget()
managedEBookAssignment.SetTarget(target)
installIntent := graphmodels.REQUIRED_INSTALLINTENT
managedEBookAssignment.SetInstallIntent(&installIntent)
managedEBookAssignments := []graphmodels.ManagedEBookAssignmentable {
managedEBookAssignment,
}
requestBody.SetManagedEBookAssignments(managedEBookAssignments)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.DeviceAppManagement().ManagedEBooks().ByManagedEBookId("managedEBook-id").Assign().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.deviceappmanagement.managedebooks.item.assign.AssignPostRequestBody assignPostRequestBody = new com.microsoft.graph.deviceappmanagement.managedebooks.item.assign.AssignPostRequestBody();
LinkedList<ManagedEBookAssignment> managedEBookAssignments = new LinkedList<ManagedEBookAssignment>();
ManagedEBookAssignment managedEBookAssignment = new ManagedEBookAssignment();
managedEBookAssignment.setOdataType("#microsoft.graph.managedEBookAssignment");
managedEBookAssignment.setId("ae8b0d27-0d27-ae8b-270d-8bae270d8bae");
AllLicensedUsersAssignmentTarget target = new AllLicensedUsersAssignmentTarget();
target.setOdataType("microsoft.graph.allLicensedUsersAssignmentTarget");
managedEBookAssignment.setTarget(target);
managedEBookAssignment.setInstallIntent(InstallIntent.Required);
managedEBookAssignments.add(managedEBookAssignment);
assignPostRequestBody.setManagedEBookAssignments(managedEBookAssignments);
graphClient.deviceAppManagement().managedEBooks().byManagedEBookId("{managedEBook-id}").assign().post(assignPostRequestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const assign = {
managedEBookAssignments: [
{
'@odata.type': '#microsoft.graph.managedEBookAssignment',
id: 'ae8b0d27-0d27-ae8b-270d-8bae270d8bae',
target: {
'@odata.type': 'microsoft.graph.allLicensedUsersAssignmentTarget'
},
installIntent: 'required'
}
]
};
await client.api('/deviceAppManagement/managedEBooks/{managedEBookId}/assign')
.post(assign);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\DeviceAppManagement\ManagedEBooks\Item\Assign\AssignPostRequestBody;
use Microsoft\Graph\Generated\Models\ManagedEBookAssignment;
use Microsoft\Graph\Generated\Models\AllLicensedUsersAssignmentTarget;
use Microsoft\Graph\Generated\Models\InstallIntent;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AssignPostRequestBody();
$managedEBookAssignmentsManagedEBookAssignment1 = new ManagedEBookAssignment();
$managedEBookAssignmentsManagedEBookAssignment1->setOdataType('#microsoft.graph.managedEBookAssignment');
$managedEBookAssignmentsManagedEBookAssignment1->setId('ae8b0d27-0d27-ae8b-270d-8bae270d8bae');
$managedEBookAssignmentsManagedEBookAssignment1Target = new AllLicensedUsersAssignmentTarget();
$managedEBookAssignmentsManagedEBookAssignment1Target->setOdataType('microsoft.graph.allLicensedUsersAssignmentTarget');
$managedEBookAssignmentsManagedEBookAssignment1->setTarget($managedEBookAssignmentsManagedEBookAssignment1Target);
$managedEBookAssignmentsManagedEBookAssignment1->setInstallIntent(new InstallIntent('required'));
$managedEBookAssignmentsArray []= $managedEBookAssignmentsManagedEBookAssignment1;
$requestBody->setManagedEBookAssignments($managedEBookAssignmentsArray);
$graphServiceClient->deviceAppManagement()->managedEBooks()->byManagedEBookId('managedEBook-id')->assign()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Devices.CorporateManagement
$params = @{
managedEBookAssignments = @(
@{
"@odata.type" = "#microsoft.graph.managedEBookAssignment"
id = "ae8b0d27-0d27-ae8b-270d-8bae270d8bae"
target = @{
"@odata.type" = "microsoft.graph.allLicensedUsersAssignmentTarget"
}
installIntent = "required"
}
)
}
Set-MgDeviceAppManagementManagedEBook -ManagedEBookId $managedEBookId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.deviceappmanagement.managedebooks.item.assign.assign_post_request_body import AssignPostRequestBody
from msgraph.generated.models.managed_e_book_assignment import ManagedEBookAssignment
from msgraph.generated.models.all_licensed_users_assignment_target import AllLicensedUsersAssignmentTarget
from msgraph.generated.models.install_intent import InstallIntent
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AssignPostRequestBody(
managed_e_book_assignments = [
ManagedEBookAssignment(
odata_type = "#microsoft.graph.managedEBookAssignment",
id = "ae8b0d27-0d27-ae8b-270d-8bae270d8bae",
target = AllLicensedUsersAssignmentTarget(
odata_type = "microsoft.graph.allLicensedUsersAssignmentTarget",
),
install_intent = InstallIntent.Required,
),
],
)
await graph_client.device_app_management.managed_e_books.by_managed_e_book_id('managedEBook-id').assign.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。