Pergunta

I'm working on some DOM scraping in SP and I want to tighten up my logic around web-parts. Namely, is it safe to say that anything with a attribute of 'webpartid' is a webpart?

Some sample environments I've been in have lots of elements with this attribute that look empty/useless.

Alternatively, can I say that anything with an id = 'webpart' is a webpart? Those counts don't add up btw...

EDIT: or, is it any element with both of those attribute criteria?

Foi útil?

Solução

The following assumes SP2010. You would be 100% safe assuming that a DIV element with a webpartid attribute is the body container for the web part. If you want to find the starting point for a webpart (i.e. the chrome), look for table elements with a class attribute of s4-wpTopTable.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top