Which code segment should you use?

You have a SharePoint site that has the URL http://contoso.com/hr.You are creating a new Web
Part. You need to create a reference to the current subsite without having to dispose of any
returned objects. Which code segment should you use?

You have a SharePoint site that has the URL http://contoso.com/hr.You are creating a new Web
Part. You need to create a reference to the current subsite without having to dispose of any
returned objects. Which code segment should you use?

A.
Dim site As SPWeb = SPContext.Current.Web

B.
Dim siteCollection As New SPSite(“http://www.contoso.com”) Dim site As SPWebCollection =
siteCollection.AllWebs

C.
Dim siteCollection As New SPSite(“http://www.contoso.com”) Dim site As SPWeb =
siteCollection.RootWeb

D.
Dim site As SPSite = SPContext.Current.Site



Leave a Reply 0

Your email address will not be published. Required fields are marked *