sharepoint - Retrieving the associated shared service provider's name? -


how programmatically retrieve name of shared services provider that's associated specific sharepoint web application?

i have custom solution needs to:

  1. enumerate web applications it's deployed to
  2. figure out shared services provider each of web applications associated with
  3. access business data catalog installed on ssp retrieve data
  4. enumerate through site collections in web applications
  5. perform various tasks within site collections according data

i got points 1, 3, 4 , 5 figured out, 2 troublesome. want avoid hardcoding ssp name anywhere , not require farm administrator manually edit configuration file. information need in sharepoint configuration database, need know how access through object model.

unfortunately there no supported way know of can done. relevant class sharedresourceprovider in microsoft.office.server.administration namespace, in microsoft.office.server dll. it's marked internal pre-reflection:

sharedresourceprovider sharedresourceprovider = servercontext.getcontext(spcontext.current.site).sharedresourceprovider; string sspname = sharedresourceprovider.name; 

post-reflection:

servercontext sc = servercontext.getcontext(spcontext.current.site); propertyinfo srpprop = sc.gettype().getproperty(     "sharedresourceprovider", bindingflags.nonpublic | bindingflags.instance); object srp = srpprop.getvalue(sc, null); propertyinfo srpnameprop = srp.gettype().getproperty(     "name", bindingflags.public | bindingflags.instance); string sspname = (string)srpnameprop.getvalue(srp, null); 

an alternative write sql query on configuration database isn't recommended.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -