Which code segment should you add at line 10?

You have a document library named Documents. Minor and major version management is
enabled for the document library. You plan to add a document named MyFile.docx to Documents.
You create a console application that contains the following code segment. (Line numbers are
included for reference only.) 01 Using site As New SPSite(“http://intranet”) 02 Dim documents As
SPList = site.RootWeb.Lists(“Documents”) 03 Dim fstream As FileStream =
File.OpenRead(“MyFile.docx”) 04 Dim content As Byte() = New Byte(fstream.Length – 1) {} 05
fstream.Read(content, 0, CInt(fstream.Length)) 06 fstream.Close() 07
site.RootWeb.Files.Add(documents.RootFolder.Url & “/MyFile.docx”, content, True) 08 Dim file As
SPFile = site.RootWeb.GetFile(documents.RootFolder.Url & “/ MyFile.docx”) 09
file.CheckIn(String.Empty) 10 11 End Using You need to ensure that all users can see the
document. Which code segment should you add at line 10?

You have a document library named Documents. Minor and major version management is
enabled for the document library. You plan to add a document named MyFile.docx to Documents.
You create a console application that contains the following code segment. (Line numbers are
included for reference only.) 01 Using site As New SPSite(“http://intranet”) 02 Dim documents As
SPList = site.RootWeb.Lists(“Documents”) 03 Dim fstream As FileStream =
File.OpenRead(“MyFile.docx”) 04 Dim content As Byte() = New Byte(fstream.Length – 1) {} 05
fstream.Read(content, 0, CInt(fstream.Length)) 06 fstream.Close() 07
site.RootWeb.Files.Add(documents.RootFolder.Url & “/MyFile.docx”, content, True) 08 Dim file As
SPFile = site.RootWeb.GetFile(documents.RootFolder.Url & “/ MyFile.docx”) 09
file.CheckIn(String.Empty) 10 11 End Using You need to ensure that all users can see the
document. Which code segment should you add at line 10?

A.
file.Update()

B.
file.CanOpenFile(true)

C.
file.Publish(string.Empty)

D.
file.ReleaseLock(string.Empty)



Leave a Reply 0

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