Customising SharePoint Usage Stats - Part Two Code
by , 18th February 2011 at 10:56 AM (779 Views)
Code:SPFarm farm = this.Farm; int intTime; foreach (SPService service in farm.Services) {if (service isSPWebService) {SPWebService webService = (SPWebService)service; foreach (SPWebApplication webApplication in webService.WebApplications) {foreach (SPSite site in webApplication.Sites) {OrganizationProfileManager organizationManager = newOrganizationProfileManager(SPServiceContext.GetContext(site));OrganizationProfile root = organizationManager.RootOrganization;}foreach (OrganizationProfile organizationProfile in root.GetChildren()) {if (!(listOrganizations.Contains(organizationProfile))) {listOrganizations.Add(organizationProfile);}}}}} foreach (OrganizationProfile organizationProfile in listOrganizations) {AddOrgPairing(organizationProfile.ID.ToString(), organizationProfile.GetImmediateMembers().ToList<UserProfile>());}




Email Blog Entry

