How to get all sites and sub-sites in SharePoint and access an image library/list? -


how sites , sub-sites in sharepoint , access image library/list?

i looking forward achieve via sharepoint object model. inside each site or subsite want access image library/list,

alt text

after getting list, how set option of 'required content approval selected items' 'yes' 'no'?

use spfarm object web applications use spwebapplication sitecollection , use spsite webs.

you have loop through 3 sites under site collection. if want find subsites under spweb please call spwebs recursively until don't find webs under spweb each spweb.

spfarm farm = spfarm.local; spwebservice service = farm.services.getvalue<spwebservice>(""); foreach (spwebapplication webapp in service.webapplications) {     foreach (spsite sitecoll in webapp.sites)     {         foreach (spweb web in sitecoll.allwebs)         {             <<use recursion here sub webs>>             web.dispose();         }         sitecoll.dispose();     } } 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -