Which code segment should you insert at line 04?

You are creating a Microsoft Windows SharePoint Services application.

You write the following code segment. (Line numbers are included for reference only.)

01 Public Sub DownloadDocument ( ByVal web As SPWeb )
02 Dim docLib As SPDocumentLibrary = _
CType ( web.Lists (“shared Documents”), SPDocumentLibrary )
03 Const fil eShare As String = “C:\Download”
04 …
05 End Sub

You need to move each document to the C:\Download folder. You also need to remove each document from the document library.

Which code segment should you insert at line 04?

You are creating a Microsoft Windows SharePoint Services application.

You write the following code segment. (Line numbers are included for reference only.)

01 Public Sub DownloadDocument ( ByVal web As SPWeb )
02 Dim docLib As SPDocumentLibrary = _
CType ( web.Lists (“shared Documents”), SPDocumentLibrary )
03 Const fil eShare As String = “C:\Download”
04 …
05 End Sub

You need to move each document to the C:\Download folder. You also need to remove each document from the document library.

Which code segment should you insert at line 04?

A.
For Each folder As SPFolder In docLib.Folders
folder.MoveTo ( fileShare )
Next

B.
For Each item As SPListItem In docLib.Items
Dim targetPath As String = Path.Combine ( fileShare , item.File.Name )
item.File.MoveTo ( targetPath )
Next

C.
For Each item As SPListItem In docLib.Items
If item.File.Exists Then
Dim targetPath As String = Path.Combine ( fileShare , item.File.Name )
item.File.MoveTo ( targetPath )
End If
Next

D.
For Each item As SPListItem In docLib.Items
Dim targetPath As String = Path.Combine ( fileShare , item.File.Name )
‘ Using
Dim stream As FileStream = _
New FileStream ( targetPath , FileMode.Create )
Try
stream.Write ( item.File.OpenBinary (), 0, _
CType ( item.File.Length , Integer))
Finally
CType (stream, IDisposable ).Dispose()
End Try
item.Delete ()
Next



Leave a Reply 0

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