cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DBeverdam
Frequent Visitor

Add Text webpart to SharePoint site via POST method

Hello, 

 

For a client I automatically create a SharePoint site (with Power Automate) for every new project (sql connection). Besides the Site I want a textfield filled with information about the project. Is there a way via a POST method to upload projectinformation to a textfield web part?

 

Can anyone help me?

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @DBeverdam,


You can add that in the json of your SavePage request I shared with you earlier in the other thread about creating QuickLinks. You can add it within the CanvasContent1 property.


The reuse the example of earlier it would look something like below.

 

The text web part itself:

 

{\"controlType\":4,\"id\":\"ed2476c7-994a-4a07-a322-8afe873c05f2\",\"innerHTML\":\"<p>Hello world in a Text Web Part from Power Automate!<br></p>\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":0.5,\"sectionFactor\":8,\"layoutIndex\":1},\"addedFromPersistedData\":true}

 

 

The example in the setup with the two tiles (Quick Links Web Part) as well.

 

{
  "__metadata": {
    "type": "SP.Publishing.SitePage"
  },
  "CanvasContent1": "[{\"controlType\":4,\"id\":\"ed2476c7-994a-4a07-a322-8afe873c05f2\",\"innerHTML\":\"<p>Hello world in a Text Web Part from Power Automate!<br></p>\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":0.5,\"sectionFactor\":8,\"layoutIndex\":1},\"addedFromPersistedData\":true},{\"controlType\":3,\"webPartId\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8},\"id\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"addedFromPersistedData\":true,\"reservedHeight\":127,\"reservedWidth\":776,\"webPartData\":{\"id\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"instanceId\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"title\":\"Quick links\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{\"title\":\"Quick links\",\"items[0].title\":\"@{variables('TileTitle')}\",\"items[1].title\":\"@{variables('TileTitle2')}\"},\"imageSources\":{\"items[0].rawPreviewImageUrl\":\"\"},\"links\":{\"baseUrl\":\"\",\"items[0].sourceItem.url\":\"@{variables('TileUrl')}\",\"items[1].sourceItem.url\":\"@{variables('TileUrl2')}\"},\"componentDependencies\":{\"layoutComponentId\":\"706e33c8-af37-4e7b-9d22-6e5694d92a6f\"},\"customMetadata\":{\"items[0].rawPreviewImageUrl\":{\"fixedWidth\":100,\"minCanvasWidth\":32767}}},\"dataVersion\":\"2.2\",\"properties\":{\"items\":[{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":2,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767},{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":1,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767}],\"isMigrated\":true,\"layoutId\":\"List\",\"shouldShowThumbnail\":true,\"hideWebPartWhenEmpty\":true,\"dataProviderId\":\"QuickLinks\",\"listLayoutOptions\":{\"showDescription\":false,\"showIcon\":true},\"imageWidth\":100,\"buttonLayoutOptions\":{\"showDescription\":false,\"buttonTreatment\":2,\"iconPositionType\":2,\"textAlignmentVertical\":2,\"textAlignmentHorizontal\":2,\"linesOfText\":2},\"waffleLayoutOptions\":{\"iconSize\":1,\"onlyShowThumbnail\":false},\"webId\":\"@{variables('webId')}\",\"siteId\":\"@{variables('SiteId')}\"}}},{\"id\":\"emptySection\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4},\"addedFromPersistedData\":true},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true}}]",
  "PageRenderingState": {
    "canvasState": {
      "selection": {
        "control": {
          "type": 3,
          "id": "5f80a41e-a354-4bdf-9b21-42539ba00d98"
        },
        "zoneIndex": 1
      }
    }
  },
  "BannerImageUrl": "",
  "Title": "Home"
}

 

 

addtextwebpart.png

 

End result should look something like below.

 

addtextwebpart_test.png

View solution in original post

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @DBeverdam,


You can add that in the json of your SavePage request I shared with you earlier in the other thread about creating QuickLinks. You can add it within the CanvasContent1 property.


The reuse the example of earlier it would look something like below.

 

The text web part itself:

 

{\"controlType\":4,\"id\":\"ed2476c7-994a-4a07-a322-8afe873c05f2\",\"innerHTML\":\"<p>Hello world in a Text Web Part from Power Automate!<br></p>\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":0.5,\"sectionFactor\":8,\"layoutIndex\":1},\"addedFromPersistedData\":true}

 

 

The example in the setup with the two tiles (Quick Links Web Part) as well.

 

{
  "__metadata": {
    "type": "SP.Publishing.SitePage"
  },
  "CanvasContent1": "[{\"controlType\":4,\"id\":\"ed2476c7-994a-4a07-a322-8afe873c05f2\",\"innerHTML\":\"<p>Hello world in a Text Web Part from Power Automate!<br></p>\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":0.5,\"sectionFactor\":8,\"layoutIndex\":1},\"addedFromPersistedData\":true},{\"controlType\":3,\"webPartId\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8},\"id\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"addedFromPersistedData\":true,\"reservedHeight\":127,\"reservedWidth\":776,\"webPartData\":{\"id\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"instanceId\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"title\":\"Quick links\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{\"title\":\"Quick links\",\"items[0].title\":\"@{variables('TileTitle')}\",\"items[1].title\":\"@{variables('TileTitle2')}\"},\"imageSources\":{\"items[0].rawPreviewImageUrl\":\"\"},\"links\":{\"baseUrl\":\"\",\"items[0].sourceItem.url\":\"@{variables('TileUrl')}\",\"items[1].sourceItem.url\":\"@{variables('TileUrl2')}\"},\"componentDependencies\":{\"layoutComponentId\":\"706e33c8-af37-4e7b-9d22-6e5694d92a6f\"},\"customMetadata\":{\"items[0].rawPreviewImageUrl\":{\"fixedWidth\":100,\"minCanvasWidth\":32767}}},\"dataVersion\":\"2.2\",\"properties\":{\"items\":[{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":2,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767},{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":1,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767}],\"isMigrated\":true,\"layoutId\":\"List\",\"shouldShowThumbnail\":true,\"hideWebPartWhenEmpty\":true,\"dataProviderId\":\"QuickLinks\",\"listLayoutOptions\":{\"showDescription\":false,\"showIcon\":true},\"imageWidth\":100,\"buttonLayoutOptions\":{\"showDescription\":false,\"buttonTreatment\":2,\"iconPositionType\":2,\"textAlignmentVertical\":2,\"textAlignmentHorizontal\":2,\"linesOfText\":2},\"waffleLayoutOptions\":{\"iconSize\":1,\"onlyShowThumbnail\":false},\"webId\":\"@{variables('webId')}\",\"siteId\":\"@{variables('SiteId')}\"}}},{\"id\":\"emptySection\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4},\"addedFromPersistedData\":true},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true}}]",
  "PageRenderingState": {
    "canvasState": {
      "selection": {
        "control": {
          "type": 3,
          "id": "5f80a41e-a354-4bdf-9b21-42539ba00d98"
        },
        "zoneIndex": 1
      }
    }
  },
  "BannerImageUrl": "",
  "Title": "Home"
}

 

 

addtextwebpart.png

 

End result should look something like below.

 

addtextwebpart_test.png

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,462)