Getting '409 Conflict' Trying to create contact folder

Sillas Poulsen 0 Reputation points
2024-05-06T09:22:33.91+00:00

I am trying to programmatically create new contact folders for users in an organization. The problem arises when I attempt to create a folder—it says there's a conflict. However, I've tried to retrieve the existing contact folders right before creation, and there's no folder with the same display name. I don't understand why this conflict is happening.

   
   var response1 = await httpClient.GetAsync(
        $"https://graph.microsoft.com/v1.0/users/{userId}/contactFolders"
    );
    
    
    var responseString1 = await response1.Content.ReadAsStringAsync();


    var response = await httpClient.PostAsync(
        $"https://graph.microsoft.com/v1.0/users/{userId}/contactFolders",
        content
    );
    
    var responseString = await response.Content.ReadAsStringAsync();

Thank you very much in advance,

Outlook
Outlook
A family of Microsoft email and calendar products.
3,427 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
{count} votes