powershell - Get-PnPPage cannot get right webpart section - Stack Overflow

admin2025-04-21  2

When I used Get-PnPPage command to get the webparts of a page, the result was as following. However, when I got the section of a webpart, the result returned was not an integer.

InstanceId                           Type        Title             Section Column Position PropertiesJson
----------                           ----        -----             ------- ------ -------- --------------
dfa0cc4b-ee42-4729-831e-663bc5fbceea PageWebPart Banner            1       1      1        {"title":"Office Equipment"…
41e8dbba-3af2-4667-b26d-b19593f9823c PageText                      2       1      1
848df38c-35a9-484f-bbbf-1a23d02f87b5 PageWebPart Quick links       2       1      2        {"items":[{"sourceItem":{"g…
a1bcd9d0-574a-4f27-b919-c1d9ed538a42 PageWebPart Divider           3       1      1        {"length":100,"weight":1}
d6a84ba0-fbf1-489b-b60e-a8a663bd099a PageText                      3       1      2
58ae73cc-d400-4665-9982-5826ee0a99cc PageWebPart Divider           4       1      1        {"length":100,"weight":1}
a224bf7c-ae8e-43cd-85ff-169092b9bb5d PageText                      4       1      2
14e3ce6c-6d59-47b6-80f5-489b7946be0c PageWebPart Divider           5       1      1        {"length":100,"weight":1}
 $webparts2[5].Section.order
1.625

How can I get the correct Section integer?

When I used Get-PnPPage command to get the webparts of a page, the result was as following. However, when I got the section of a webpart, the result returned was not an integer.

InstanceId                           Type        Title             Section Column Position PropertiesJson
----------                           ----        -----             ------- ------ -------- --------------
dfa0cc4b-ee42-4729-831e-663bc5fbceea PageWebPart Banner            1       1      1        {"title":"Office Equipment"…
41e8dbba-3af2-4667-b26d-b19593f9823c PageText                      2       1      1
848df38c-35a9-484f-bbbf-1a23d02f87b5 PageWebPart Quick links       2       1      2        {"items":[{"sourceItem":{"g…
a1bcd9d0-574a-4f27-b919-c1d9ed538a42 PageWebPart Divider           3       1      1        {"length":100,"weight":1}
d6a84ba0-fbf1-489b-b60e-a8a663bd099a PageText                      3       1      2
58ae73cc-d400-4665-9982-5826ee0a99cc PageWebPart Divider           4       1      1        {"length":100,"weight":1}
a224bf7c-ae8e-43cd-85ff-169092b9bb5d PageText                      4       1      2
14e3ce6c-6d59-47b6-80f5-489b7946be0c PageWebPart Divider           5       1      1        {"length":100,"weight":1}
 $webparts2[5].Section.order
1.625

How can I get the correct Section integer?

Share Improve this question asked Jan 22 at 21:02 H WangH Wang 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

That output is not from Get-PnPPage, it is from Get-PnPPageComponent

Get-PnPPage will return a collection of components

As for why $webparts2[5].Section.order does not return an integer, I would need the page definition, I could not reproduce it with pages I tested

转载请注明原文地址:http://anycun.com/QandA/1745228352a90496.html