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….!

TVAllsites.Nodes.Add(myweb.Title.ToString)

End If

Next

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

Try

For Each spvs In spglobaladmin.VirtualServers

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

CmbVirtualServers.Items.Add(spvs.Url.ToString)

End If

Next

Catch ex As Exception

MsgBox(ex.ToString)

End Try

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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: