Which code segment should you add at line 11?

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 (SPSite site = new SPSite(“http://intranet”)) 02 { 03 SPList
documents = site.RootWeb.Lists[“Documents”]; 04 FileStream fstream =
File.OpenRead(@”MyFile.docx”); 05 byte[] content = new byte[fstream.Length]; 06
fstream.Read(content, 0, (int)fstream.Length); 07 fstream.Close(); 08
site.RootWeb.Files.Add(documents.RootFolder.Url + “/MyFile.docx”, content, true); 09 SPFile file
= site.RootWeb.GetFile(documents.RootFolder.Url + “/MyFile. docx”); 10
file.CheckIn(string.Empty); 11 12 } You need to ensure that all users can see the document.

Which code segment should you add at line 11?

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 (SPSite site = new SPSite(“http://intranet”)) 02 { 03 SPList
documents = site.RootWeb.Lists[“Documents”]; 04 FileStream fstream =
File.OpenRead(@”MyFile.docx”); 05 byte[] content = new byte[fstream.Length]; 06
fstream.Read(content, 0, (int)fstream.Length); 07 fstream.Close(); 08
site.RootWeb.Files.Add(documents.RootFolder.Url + “/MyFile.docx”, content, true); 09 SPFile file
= site.RootWeb.GetFile(documents.RootFolder.Url + “/MyFile. docx”); 10
file.CheckIn(string.Empty); 11 12 } You need to ensure that all users can see the document.

Which code segment should you add at line 11?

A.
file.CanOpenFile(true);

B.
file.Publish(string.Empty);

C.
file.ReleaseLock(string.Empty);

D.
file.Update();



Leave a Reply 0

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