How do I change the iconColor of a Sharepoint GraphAPI.DriveItem

Martin Clarke 40 Reputation points
2023-11-23T22:08:26.0666667+00:00

From Sharepoint, a user is able to set the color of a folder, eg:
Folder with color changed

From GraphAPI, the DriveItem shows this color: https://graph.microsoft.com/v1.0/drives/<driveid>/items/<itemid> API Response

Attempting to patch this value: {"decorator": {"iconColor": "darkOrange"}} Returns this response:

{
    "error": {
        "code": "generalException",
        "message": "General exception while processing",
        "innerError": {
            "date": "2023-11-23T22:01:55",
            "request-id": "b5618811-6f98-4cf8-9a2a-b81d35fe559d",
            "client-request-id": "00d0e876-c8f6-a2e9-5de7-878a69ba7805"
        }
    }
}

The driveItem documentation doesn't mention this property. Is there any way to change this value via an API?

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph

Answer accepted by question author
RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
2023-11-24T02:33:57.7566667+00:00

Hi @Martin Clarke,

Per my research, currently there is no such api to change icon color. This is a new feature in SharePoint Online. SharePoint only support to change the color from UI.

User's image

Since it turns out to be a by-design one. It is highly recommended that you can vote this ticket. Many features of our current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. Thanks for your understanding.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

5 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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