0

我感到有点气馁。我需要你的帮助。我从 3 天前开始尝试使用 ms grap api 在邀请活动中发送附件。附件显示在我的活动中,但未显示给与会者。我以多种形式尝试了许多场景和许多修复,但 iot 不起作用。你有什么想法吗?这是我的代码:

FileAttachment attachment = new FileAttachment();
    attachment.name = "Proposition_commerciale";
    attachment.oDataType = "#microsoft.graph.fileAttachment";

    attachment.isInline = false;

    attachment.contentType = "text/plain";

    java.io.File filePath = new File(Launcher.RESOURCES + "PDF/test.txt");

    try {
        byte[] file = Files.readAllBytes(Paths.get(filePath.toString()));

        byte[] encoded = java.util.Base64.getEncoder().encode(file);
        attachment.contentBytes = Base64.getDecoder().decode(encoded);
    } catch (Exception e) {
    }
    Event event = graphClient.users(mailUser)
            .events()
            .buildRequest()
            .post(newEvent);

    rendezVousMicrosoft.idOutlook = event.id;


    Attachment attachement = graphClient.users(mailUser).events(event.id).attachments()
            .buildRequest()
            .post(attachment);
4

0 回答 0