'How to upload contentBytes chunk by chunk on Graph url return by createUploadSession graph API?

As per microsoft graph API documentation the createUploadSession graph API only return the URL where attachment can upload but how to upload attachment chunk by chunk in javascript? does anyone knows? Thanks in advance. I'm referring this reference



Solution 1:[1]

Here is the reference for attaching the Attachment to a post in JavaScript, Please refer this Document

    const options = {
    authProvider,
};

const client = Client.init(options);

const reply = {
  post: {
    body: {
      contentType: 'text',
      content: 'Which quarter does that file cover? See my attachment.'
    },
    attachments: [{
      '@odata.type': '#microsoft.graph.fileAttachment',
      name: 'Another file as attachment',
      contentBytes: 'VGhpcyBpcyBhIGZpbGUgdG8gYmUgYXR0YWNoZWQu'
    } ]
  }
};

await client.api('/groups/1848753d-185d-4c08-a4e4-6ee40521d115/threads/AAQkADJUdfolA==/reply')
    .post(reply);

Hope this helpful.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mehtab Siddique