How to add comments,mentions for document collaborations(excel,word and powerpoint) using microsoft graph using java client

Pradeep Gopal 0 Reputation points
2024-09-18T22:39:07.27+00:00

I have a requirement for document collaboration for different file types like power point,excel and word documents.When using microsoft graph to add comments to the microsoft word I don't see any API's listed to set comments.I only see JavaScript API. I tried WorkbookComment API but I saw it only supports excel like this .When I use the following api for document

WorkbookComment comments = new WorkbookComment(); comments.content = content; graphService.getAppClient() .drive() .items(documentId) .workbook() .comments() .buildRequest() .post(comments); I get [Some information was truncated for brevity, enable debug logging for more details]] with root cause

com.microsoft.graph.http.GraphServiceException: Error code: UnknownError

Error message: {"code":"InvalidRequest","message":"Missing header Client-Request-Id. Header Client-Request-Id is not a guid.","innerError":{"request-id":"00000000-0000-0000-0000-000000000000","date":"2024-09-18T15:08:58.7756471-07:00"}}

Even https://graph.microsoft.com/v1.0/drive/items/{itemid}/workbook/comments gives me the same above error.I tried to add the client-request-id using generated uuid but still issue remain same.Please let me know which api's I have to use collaboration for word,powerpoint,excel

{
    "error": {
        "code": "UnknownError",
        "message": "{\"code\":\"InvalidRequest\",\"message\":\"Missing header Client-Request-Id. Header Client-Request-Id is not a guid.\",\"innerError\":{\"request-id\":\"00000000-0000-0000-0000-000000000000\",\"date\":\"2024-09-18T15:17:35.1150822-07:00\"}}",
        "innerError": {
            "date": "2024-09-18T22:17:35",
            "request-id": "9e75f693-5057-43e8-863e-19b9eb1d11f0",
            "client-request-id": "e802fd2e-181f-4d3b-abb2-f0c35bc4553e"
        }
    }
}
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,047 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,716 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,918 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.