a) SharePoint Server Architecture
b) SharePoint Object Hierarchy
So as you can see the SharePoint Object model is relatively straightforward. Here we have a very simple slip of code which start from reaching all services of the Farm and navigate through to the item and file level objects.
1: foreach (SPService svc in SPFarm.Local.Services)
2: {
3: if (svc is SPWebService)
4: {
5: foreach (SPWebApplication webApp in ((SPWebService)svc).WebApplications)
6: {
7: foreach (SPSite site in webApp.Sites)
8: {
9: foreach (SPWeb web in site.AllWebs)
10: {
11: foreach (SPList list in web.Lists)
12: {
13: foreach (SPListItem i in list.Items)
14: {
15: // do something
16: }
17: }
18:
19: foreach (SPFile f in web.Files)
20: {
21: // do something
22: }
23: }
24: }
25: }
26: }
27: }
No comments:
Post a Comment