microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

An error occurred while trying to add content to the list in SharePoint #4

Open 4at-nk opened 4 years ago

4at-nk commented 4 years ago

Hello! I am using MS Graph sdk v1.5 in Java code. I am trying to add content type to the list as follows:

IGraphServiceClient graphClient = GraphServiceClient.builder()
        .authenticationProvider(authenticationProvider)
        .buildClient();

ContentType contentType = new ContentType();
contentType.name = "MyCustomContentType";
contentType.description = "MyCustomContentType's description";
contentType.group = "List Content Types";
contentType.hidden = false;
contentType.parentId = "0x0103";
contentType.id = "0x010300B8123BA6FE3D6045BF4F6DF992B6ABE7";
contentType.readOnly = false;
contentType.sealed = false;

contentType = graphClient.sites(siteId)
        .lists(listId)
        .contentTypes()
        .buildRequest()
        .post(contentType);

This approach is not described in the documentation, but I have not found others.

Expected behavior

Content type with the specified id and inherited from the content with id "0x0103" will be created in the list.

Actual behavior

It throws exception that contains follows response:

{
    "error": {
        "code": "itemNotFound",
        "message": "The specified site content type was not found",
        "innerError": {
            "request-id": "1ac12fed-eaf3-4d03-a3c4-b44ddacada72",
            "date": "2020-05-16T17:12:11"
        }
    }
}
petrhollayms commented 7 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.