PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You create a Microsoft Windows SharePoint Services site that contains a document library.

You need to check out the current version of each document in the root folder of the document library.

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Shared Sub CheckOutFiles(ByVal web As SPWeb, ByVal _
docLibraryName As String)
Dim lists As SPListCollection = web.Lists
lists.IncludeRootFolder = True
Dim docLib As SPDocumentLibrary = CType(lists(docLibraryName), _
SPDocumentLibrary)
For Each file As SPFile In docLib.RootFolder.Files
If file.CheckOutStatus = SPFile.SPCheckOutStatus.None Then
file.CheckOut()
End If
Next
End Sub

B.
Shared Sub CheckOutFiles(ByVal web As SPWeb, ByVal _
docLibraryName As String)
web.Lists.IncludeRootFolder = True
Dim docLib As SPDocumentLibrary = CType(web.Lists(docLibraryName), _
SPDocumentLibrary)
For Each file As SPFile In docLib.RootFolder.Files
If file.CheckOutStatus = SPFile.SPCheckOutStatus.None Then
file. CheckOut()
End If
Next
End Sub

C.
Shared Sub CheckOutFiles(ByVal web As SPWeb, ByVal _
docLibraryName As String)
web.Lists.IncludeRootFolder = True
Dim docLib As SPDocumentLibrary = CType(web.Lists(docLibraryName), _
SPDocumentLibrary)
For Each item As SPListItem In docLib.Items
If item(“CheckOutStatus”).ToString() = _
SPFile.SPCheckOutStatus.None.ToString() Then
item(“CheckOut”) = True
End If
Next
End Sub.

D.
Shared Sub CheckOutFiles(ByVal web As SPWeb, ByVal _
docLibraryName As String)
Dim lists As SPListCollection = web.Lists
lists.IncludeRootFolder = True
Dim docLib As SPDocumentLibrary = CType(lists(docLibraryName), _
SPDocumentLibrary)
For Each item As SPListItem In docLib.Items
If item(“CheckOutStatus”).ToString() = _
SPFile.SPCheckOutStatus.None.ToString() Then
item(“CheckOut”) = True
End If
Next
End Sub


Leave a Reply