Sharepoint BannerUrl field not update

Mateus Ferreira 45 Reputation points
2024-07-05T13:51:29.99+00:00

I need to update the cover image of Events (ListItem Event) on SharePoint using the Graph API. I'm using APP ONLY ACCESS mode for authentication with this endpoint:

https://login.microsoftonline.com/{{tenant_id}}/oauth2/v2.0/token

My Application has the "Sites.Manage.All" scope.

When I call the endpoint to update or create an event, if I include the "BannerUrl" field, I always get the following error:

   {
    "error": {
        "code": "generalException",
        "message": "General exception while processing",
        "innerError": {
            "date": "2024-06-28T11:50:07",
            "request-id": "a7f573a1-f7e9-49b8-9e0c-160a1d68cbf7",
            "client-request-id": "a7f573a1-f7e9-49b8-9e0c-160a1d68cbf7"
        }
    }
}

My request:

POST /v1.0/sites/{{site_id}}/lists/{{list_id}}/items HTTP/1.1
Host: graph.microsoft.com
Content-Type: application/json
Authorization: Bearer
Content-Length: 507
{
	"fields": {
		"Title": "Example",
		"EventDate": "2024-07-15 09:00:00+00:00",
		"EndDate": "2024-07-15 17:00:00+00:00",
		"Category": "Example",
		"Description": "Hello world",
		"Location": "Avenida Paulista, 1000 - Bela Vista, São Paulo, SP 01313-000, Brazil",
		"fAllDayEvent": true,
		"BannerUrl": "https://image.jpg"
	}
}

I believe there are two fields, BannerImageUrl, and BannerUrl. BannerUrl seems to be the correct one, but I always get an error when I try to define this field!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,343 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,875 questions
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 27,086 Reputation points Microsoft Vendor
    2024-07-11T07:47:52.5666667+00:00

    Hi @Mateus Ferreira ,

    Sorry to hear that.

    I tested it and the situation is the same as yours. This is because we still cannot update the Hyperlink column in the SharePoint column list through the graph API.

    As a workaround, it is recommended you use rest api to update the column. For your reference:

    https://sharepoint.stackexchange.com/questions/88540/how-do-i-update-a-hyperlink-field-using-the-rest-api

    Also, I found a feedback on this issue and you can vote for it.

    Have a nice day!


    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 27,086 Reputation points Microsoft Vendor
    2024-07-09T08:43:59+00:00

    Hi @Mateus Ferreira ,

    Welcome to Q&A forum!

    Updating or creating an event with a banner image in SharePoint using the Microsoft Graph API can be tricky due to the specifics of the API endpoints and field requirements. Here are a few things to check and try out:

    1. Check Field Availability: Make sure BannerUrl is a valid field in your list. You can retrieve the list schema using the Graph API to confirm the available fields.
      
         GET /v1.0/sites/{site-id}/lists/{list-id}/columns
      
      
    2. Validate URL: Ensure that the URL provided in BannerUrl is accessible and valid.
    3. Correct Scoping: Ensure your application has the required permissions. Sites.Manage.All seems correct, but you can also try Sites.FullControl.All.
    4. Format Date Time: Ensure that the date and time format is correct. Sometimes minor formatting issues can cause errors.
    5. InnerError Details: Use the request and client request IDs provided in the error response to check logs in the Microsoft Azure portal for more detailed error information.
    6. Test Without BannerUrl: Send the request without the BannerUrl field to ensure that other fields are not causing the issue.
    7. Try BannerImageUrl: Although you suspect BannerUrl to be the correct field, it may be worth trying BannerImageUrl as well.

    If the issue persists, consider breaking down the problem:

    1. Create the Event Without the Banner: First, create an event without the banner to ensure the basic functionality works.
    2. Update the Event with BannerUrl: Then, try updating the same event with the BannerUrl. Hope this can help.

    If the answer is helpful, please click "Accept as 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.

    1 person found this answer helpful.

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.