Change column name using REST API - Logic App

Jasper Bakker 20 Reputation points
2025-01-08T13:44:53.6+00:00

Good day to you all. First time posting a request. Hope it get’s received well.

I seem to have a problem and not sure what I might be doing wrong. Maybe it's a bug. I don't know.

I am trying to provision a SharePoint communication site programmatically using SharePoint REST api (_api/SPSiteManager/create). Hence no problems here. Site gets created without any problems using a predefined body.

User's image

In my workflow I also provision multiple columns (at the site level) using SchemaXML (_api/Web/Fields/createfieldasxml). The internal name and display name differ. No problems here. It is possible to share the XML, but I do not think this is the problem.

User's image

After creating the SharePoint columns at the site level I want to add them to the default SharePoint SitePages library using the same SchemaXml (_api/Web/Lists(guid'{GUID of SitePages lib.}')/Fields/createfieldasxml). Hench the problem (I think).

User's image

It appears that when provisioning the site programmatically (_api/SPSiteManager/create), a not so unique GUID, is being used for the SitePages library. I found the following article explaining this problem: https://www.wictorwilen.se/blog/when-a-guid-is-not-really-unique-i-m-looking-at-you-sharepoint/

When patching the field column Title/Display name of the columns using the not so unique id of the SitePages library and a predifined Id of the column (hence the use of SchemaXML), I am unable to update the field name. It simple does not reflect correctly in SharePoint.

User's image

I have tried multiple ways to update the Title field (using Graph, REST, not use SchemaXML, maybe caching issue in browser). They all simple do not change the display name. I have also tried provisioning the site using powershell using New-PnPSite. This also creates a site with the same SitePages GUID. I have not testing changing the display name afterwords, but I prefer not to use PowerShell to keep the workflow as simple and straight forward as possible (use of one technology).

Manualy changing the display name in SharePoint does work (how strange). Changing the display name of SitePages columns using mentioned Graph/REST calls in different sites (forinstance a group) does work.

I simply do not understand what I am doing wrong or what I might need to do to get this to work. Maybe manually provision the SitePages library. I am not getting any more ideas at this moment.

All help is very much appreciated!

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. Yanli Jiang - MSFT 31,671 Reputation points Microsoft External Staff
    2025-01-10T02:48:49.1733333+00:00

    Hi @Jasper Bakker ,

    Great to know that and thanks for sharing the update here.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.". and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    [Change column name using REST API - Logic App]

    Issue Symptom:

    Good day to you all. First time posting a request. Hope it get’s received well.

    I seem to have a problem and not sure what I might be doing wrong. Maybe it's a bug. I don't know.

    I am trying to provision a SharePoint communication site programmatically using SharePoint REST api (_api/SPSiteManager/create). Hence no problems here. Site gets created without any problems using a predefined body.

    User's image

    In my workflow I also provision multiple columns (at the site level) using SchemaXML (_api/Web/Fields/createfieldasxml). The internal name and display name differ. No problems here. It is possible to share the XML, but I do not think this is the problem.

    User's image

    After creating the SharePoint columns at the site level I want to add them to the default SharePoint SitePages library using the same SchemaXml (_api/Web/Lists(guid'{GUID of SitePages lib.}')/Fields/createfieldasxml). Hench the problem (I think).

    User's image

    It appears that when provisioning the site programmatically (_api/SPSiteManager/create), a not so unique GUID, is being used for the SitePages library. I found the following article explaining this problem: https://www.wictorwilen.se/blog/when-a-guid-is-not-really-unique-i-m-looking-at-you-sharepoint/

    When patching the field column Title/Display name of the columns using the not so unique id of the SitePages library and a predifined Id of the column (hence the use of SchemaXML), I am unable to update the field name. It simple does not reflect correctly in SharePoint.

    User's image

    I have tried multiple ways to update the Title field (using Graph, REST, not use SchemaXML, maybe caching issue in browser). They all simple do not change the display name. I have also tried provisioning the site using powershell using New-PnPSite. This also creates a site with the same SitePages GUID. I have not testing changing the display name afterwords, but I prefer not to use PowerShell to keep the workflow as simple and straight forward as possible (use of one technology).

    Manualy changing the display name in SharePoint does work (how strange). Changing the display name of SitePages columns using mentioned Graph/REST calls in different sites (forinstance a group) does work.

    I simply do not understand what I am doing wrong or what I might need to do to get this to work. Maybe manually provision the SitePages library. I am not getting any more ideas at this moment.

    Current status:

    When testing no problems persisted (because I was testing in Firefox). After which I thought, can it be a caching problem, which it was. I was testing in Edge (even incognito), same result. When opening the site in Firefox the title’s were correctly displaying.

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community members to see the useful information when reading this thread. Thanks for your understanding!

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Yanli Jiang - MSFT 31,671 Reputation points Microsoft External Staff
    2025-01-09T08:29:02.3233333+00:00

    Hi @Jasper Bakker ,

    Welcome to Q&A forum!

    Based on the information you provided, we are not sure what caused the problem. We investigated from three aspects: SharePoint, the API used, and Azure Logic Apps. From the perspective of SharePoint, you can make changes manually, which means there is no problem with SharePoint. Then there may be a problem in the API call process, which is related to the working principle of the API and cannot be changed. But seeing that you have tried many methods and the result still does not work, maybe this situation is caused by the combination of API calls and Azure Logic Apps. But as a SharePoint engineer, I am not good at Azure Logic Apps and I don't have an environment to test it. It is recommended to wait for feedback from Azure Logic Apps engineers to determine the next step.

    Good 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

  2. Jasper Bakker 20 Reputation points
    2025-01-09T12:35:38.38+00:00

    I have continued my investigation. I tested in a different tenant, started from scratch. When testing no problems persisted (because I was testing in Firefox). After which I thought, can it be a caching problem, which it was. I was testing in Edge (even incognito), same result. When opening the site in Firefox the title’s were correctly displaying. How convenient. Just wasted a week of my life searching for the problem and solution.

    User's image

    Anyway, I think the problem is resolved. Next time I should do some better testing..

    0 comments No comments

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.