Re: Get a list of all top level WSS sites in SPS?



Dan,

I don't have time to code this up right now and put together a solution, but the virtual server has a collection of all sites. Can you not iterate through these and filter out whatever site a user doesn't have access to? You'll have to do impersonation (or more) in order to get the master list but can then filter by whatever criteria you're looking for. At least that's the way stsadm.exe does it.

You'll find it's not something that people have done because it's more of an admin view of a SharePoint server, and not a user view. You generally don't setup SharePoint infrastructure to mimic an organization hierarchy, you set it up in a way that makes sense for maintenance and use things like topics and listings to be your navigation. Organizations change their structure all the time and you don't want to moving sites and subsites all over the place just because the secretary pool is now under the admin department, not the HR department.

--
Bil Simser
SharePoint MVP, BSc., MCSD
Calgary, Alberta
http://weblogs.asp.net/bsimser



"Dan Marth" <danmarth@xxxxxxxxxxx> wrote in message news:#DQsENTaGHA.5004@xxxxxxxxxxxxxxxxxxxx:

Bil,

Interesting, I would like to see that demo. I have been looking all over
the internet (google, news groups, forums) for someway to get a list (by
permissions) of all the top level WSS sites in SPS using the object model
and so far, I have come up with nothing. I need it for a drop down top
navbar that many clients request, I sure wish I could fine someway to build
this navbar without having to query the SharePoint db. If you ever come
across anyway to do this, please let me know.

Thanks,
Dan

"Bil Simser [SPS MVP]" <bsimser@xxxxxxx> wrote in message
news:OpGdjlSaGHA.4416@xxxxxxxxxxxxxxxxxxxxxxx
> Dan,
>
> I've given demos to people that scoff at doing simple queries against the
> database. In the demo I have some code that does basic queries (just
> simple SELECT statements) and then I launch two web browsers to hit a
> SharePoint list. The system (my VMs) lock up and put SharePoint and SQL
> Server into a deadlock situation. Grant you, I'm doing it in a very
> controlled manner, but it can happen.
>
> Also from a pure application development perspective, just treat the
> SharePoint object model as the database. It's your contract to the
> services they provide (and will support). In .NET there are ways (through
> reflection) you can expose private member variables to the outside world,
> however someone somewhere made the decision to make them private for
> reasons of say simple encapsulation.
>
> Just because you can do something another way, doesn't mean you shouldn't.
>
> Of course, it's your choice and no, fire and brimstone will not fall from
> the heavens if you take the route you want to take. It's just a matter of
> being a good SharePoint citizen and following the rules, even if you don't
> like them.
>
> --
> Bil Simser
> SharePoint MVP, BSc., MCSD
> Calgary, Alberta
> http://weblogs.asp.net/bsimser
>
>
>
> "Dan Marth" <danmarth@xxxxxxxxxxxxx> wrote in message
> news:OAiryuRaGHA.5108@xxxxxxxxxxxxxxxxxxxx:
>
>> I hear this "don't talk directly to the db" stuff all the time and just
>> had
>> to reply. Can you give one reason why someone shouldn't do a simple
>> query
>> against the database, other than, MS might change the field names or MS
>> doesn't recommend it? I know up front that the field names might change
>> and
>> am willing to accept that. As far as MS not recommend it, I have done a
>> lot
>> of things over the years they don't recommend, unless there is a solid
>> reason for them *not* recommending it.
>>
>> I have never heard a *solid* reason for not doing a simple query on the
>> db,
>> I also never heard of a SQL database breaking because someone queried it.
>> I
>> am just really tired of hearing this stuff about the db, without any good
>> reason not to do it. If you have any proof that doing a query on the
>> SharePoint db will bring down SharePoint or corrupt the database, I am
>> all
>> ears, but I have *never* see anything like that from MS. IMHO, the only
>> reason they don't recommend talking directly to the db is because field
>> names might change *not* because it will break anything or decrease
>> performance.
>>
>> Dan
>>
>> "Bil Simser [SPS MVP]" <bsimser@xxxxxxx> wrote in message
>> news:%23sEb5TNaGHA.504@xxxxxxxxxxxxxxxxxxxxxxx
>> > Sorry, missed the part about permissions. You need to be an admin (or
>> > some
>> > funky stuff to do this via AppPool identities) in order to talk to the
>> > topology stuff.
>> >
>> > I *strongly* recommend you *not* to talk to the db directly, even if
>> > you
>> > think it's not doing anything because you're querying it.
>> >
>> > If you can't solve a problem with the existing web services and object
>> > model, then I suggest it's not a problem you should try to solve (or
>> > change the parameters of the problem to fit within the boundaries of
>> > what
>> > you can do with the object model).
>> >
>> > I know that's a sucky answer, but writing code to talk to the database
>> > directly is bad (and yes, it can work and people do it, I just don't
>> > like
>> > seeing people propagate the behavior).
>> >
>> > --
>> > Bil Simser
>> > SharePoint MVP, BSc., MCSD
>> > Calgary, Alberta
>> > http://weblogs.asp.net/bsimser
>> >
>> >
>> >
>> > "Dan Marth" <danmarth@xxxxxxxxxxxxx> wrote in message
>> > news:eFLm1GGaGHA.4916@xxxxxxxxxxxxxxxxxxxx:
>> >
>> >> Not by permissions...............if you know how, please share.
>> >>
>> >> Dan
>> >>
>> >> "Bil Simser [SPS MVP]" <bsimser@xxxxxxx> wrote in message
>> >> news:Orjqum$ZGHA.3532@xxxxxxxxxxxxxxxxxxxxxxx
>> >> > You can get it through the classes in the
>> >> > Microsoft.SharePoint.Portal.Topology namespace.
>> >> >
>> >> > --
>> >> > Bil Simser
>> >> > SharePoint MVP, BSc., MCSD
>> >> > Calgary, Alberta
>> >> > http://weblogs.asp.net/bsimser
>> >> >
>> >> >
>> >> >
>> >> > "Dan Marth" <danmarth@xxxxxxxxxxx> wrote in message
>> >> > news:eLk1YS5ZGHA.2376@xxxxxxxxxxxxxxxxxxxx:
>> >> >
>> >> >> Seems like this should be easy but I can't seem to find anyway to
>> >> >> do
>> >> >> it
>> >> >> other than a SQL statement, which I would rather not do since MS
>> >> >> doesn't
>> >> >> support querying the DB. I also do need only the top level sites a
>> >> >> user
>> >> >> has
>> >> >> permissions too, so I can't just query the sites list that lives on
>> >> >> the
>> >> >> sites area of SPS. Anyone have any ideas?
>> >> >
>> >
>

.



Relevant Pages

  • Re: Service Account Password Change
    ... app pools and changed the passwords, when I got to the sharepoint admin ... the sharepoint domain account didnt have the database admin ... Our dev environment is a domain member server running sharepoint portal ... > Detach from the config database in SharePoint Central Administration ...
    (microsoft.public.sharepoint.portalserver)
  • Steps for Migrating WSS 3.0 from Windows Internal Database to Microsoft SQL 2005
    ... done the stupid things I did when I started playing with Sharepoint ... when I first installed it and assuming that it would find the SQL 2005 ... Windows Internal Database). ... Reboot the server to finish up any uninstall scripts. ...
    (microsoft.public.sharepoint.windowsservices)
  • RE: Failing Application?
    ... logon the server, and you find the following error message in Event Log: ... Check the database connection information and make sure that the database ... this problem could be caused because the SharePoint ... Timer Service failed to contact the SharePoint database while the SBS is ...
    (microsoft.public.windows.server.sbs)
  • Re: Get a list of all top level WSS sites in SPS?
    ... this navbar without having to query the SharePoint db. ... SharePoint object model as the database. ... Can you give one reason why someone shouldn't do a simple ... As far as MS not recommend it, ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Get a list of all top level WSS sites in SPS?
    ... In the demo I have some code that does basic queries and then I launch two web browsers to hit a SharePoint list. ... Also from a pure application development perspective, just treat the SharePoint object model as the database. ... Can you give one reason why someone shouldn't do a simple query ... As far as MS not recommend it, ...
    (microsoft.public.sharepoint.portalserver.development)