Forum Discussion
Get column position of webpart modern SharePoint page
- Nov 25, 2019
Hi jorikpolhuis,
Oh, I see. You want to be able to store these in variables right? These values are stored in the object Position, contained in the spControlData attribute of the webpart. So if you access $webpart.spControlData.Position, you may find the following attributes:
ControlIndex: the order of the webpart in the section(called Position when shown in the terminal)
ZoneIndex: webpart Section
SectionIndex: webpart Column
I know, it is a bit confusing that the Section index actually stores the variable's column. But anyway, that's the way it works here. You can test it in your tenant to see if it makes sense.
Regards
Carlos_Marins Thanks for the quick reply!
I thought the same, but if i do $webpart.column i get another table with content.
In this content there is no column available.
Hi jorikpolhuis,
Oh, I see. You want to be able to store these in variables right? These values are stored in the object Position, contained in the spControlData attribute of the webpart. So if you access $webpart.spControlData.Position, you may find the following attributes:
ControlIndex: the order of the webpart in the section(called Position when shown in the terminal)
ZoneIndex: webpart Section
SectionIndex: webpart Column
I know, it is a bit confusing that the Section index actually stores the variable's column. But anyway, that's the way it works here. You can test it in your tenant to see if it makes sense.
Regards