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,

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
Post a Comment