How to differentiate between site and subsite….!

Hi All, Today i want to share a piece of code which will differentiate between a site and subsite of sharepoint so here it is i think u will get benefit from it….!

For Each myweb In mysite.AllWebs ‘ This code papulates the comboBox with top level sites

If (myweb.Webs.Count > 0) Or (myweb.IsRootWeb) Then ‘Check for top level site….!


End If


More over this is the code to exclude sharepoint central administration from list of virtual servers…!


For Each spvs In spglobaladmin.VirtualServers

If (spvs.ContentDatabases.Count > 0) Then ‘ Excludes central adminstration site


End If


Catch ex As Exception


End Try

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: