You are writing a console application that displays information about attachments for list items.
You need to display the name and length of each attachment for an item.
Which code segment should you use?
A.
Public Shared Sub DisplayAttachments(ByVal item As SPListItem)
For Each name As String In item.Attachments
Dim fullName As String = item.Attachments.UrlPrefix + name
Dim fi As FileInfo = New FileInfo(fullName)
Console.WriteLine(“{0} has a length of {1}”, fullName, fi.Length)
Next
End Sub
B.
Public Shared Sub DisplayAttachments(ByVal item As SPListItem)
For Each name As String In item.Attachments
Dim spFile As SPFile = item.Web.GetFile(name)
Console.WriteLine(“{0} has a length of {1}”, name, spFile.Length)
Next
End Sub
C.
Public Shared Sub DisplayAttachments(ByVal item As SPListItem)
For Each name As String In item.Attachments
Dim fullName As String = item.Attachments.UrlPrefix + name
Dim spFile As SPFile = item.Web.GetFile(fullName)
Console.WriteLine(“{0} has a length of {1}”, fullName, _
spFile.Length)
Next
End Sub
D.
Public Shared Sub DisplayAttachments(ByVal item As SPListItem)
For Each name As String In item.Attachments
Dim fi As FileInfo = New FileInfo(name)
Console.WriteLine(“{0} has a length of {1}”, name, fi.Length)
Next
End Sub