You create a Microsoft Windows SharePoint Services application. Your company creates two SharePoint sites named Site1 and Site2 in the same Web application.
You write the following code segment.
Private site1 As SPWeb = _
(New SPSite(“http: //localhost/Site1”)).OpenWeb()
Private site2 As SPWeb = _
(New SPSite(“http: //localhost/Site2”)).OpenWeb()
You need to copy a custom cross-site group named CrossSite from Site1 to Site2.
Which code segment should you use?
A.
Dim CrossSite As SPRoleDefinition = New SPRoleDefinition()
site2.RoleDefinitions.Add(CrossSite)
B.
Dim CrossSite As SPRoleDefinition = _
site1.RoleDefinitions(“CrossSite”)
site2.RoleDefinitions.Add(CrossSite)
C.
Dim CrossSite As SPRoleDefinition = _
site1.RoleDefinitions(“CrossSite”)
For Each role As SPRoleDefinition In site1.RoleDefinitions
If CrossSite.Type.ToString() = “CrossSite” Then
site2.RoleDefinitions.Add(CrossSite)
End If
Next
D.
Dim roles As SPRoleDefinitionCollection = _
site1.RoleDefinitions
Dim CrossSite As SPRoleDefinition = New SPRoleDefinition()
roleDefinition.BasePermissions = SPBasePermissions._
AddListItems Or SPBasePermissions.BrowseDirectories Or _
SPBasePermissions.EditListItems
CrossSite.Description = “CrossSite Group”
CrossSite.Name = “CrossSite Group”
roles.Add(CrossSite)