PrepAway - Latest Free Exam Questions & Answers

Category: 70-573

Exam 70-573: TS: Microsoft SharePoint 2010, Application Development

What should you do?

You create a Web Part that programmatically updates the description of the current SharePoint site.

The Web Part contains the following code segment. (Line numbers are included for reference only.)

01 SPSecurity.RunWithElevatedPrivileges(delegate()
02 {
03 SPSite currSite = SPContext.Current.Site;
04 SPWeb currWeb = SPContext.Current.Web;
05 using (SPSite eSite = new SPSite(currSite.ID))
06 {
07 using (SPWeb eWeb = eSite.OpenWeb(currWeb.ID))
08 {
09 eWeb.AllowUnsafeUpdates = true;
10 currWeb.Description = “Test”;
11 currWeb.Update();
12 eWeb.AllowUnsafeUpdates = false;
13 }
14 }
15 });

Users report that they receive an Access Denied error message when they use the Web Part. You need to ensure that all users can use the Web Part to update the description of the current site.

What should you do?

Which code segment should you add at line 19?

You create a Web Part that queries a list.

The Web Part contains the following code segment. (Line numbers are included for reference only.)

01 protected override void Render(HtmlTextWriter writer)
02 {
03 SPUserToken spInToken = GetTheContext(SPContext.Current.Site);
04 using (SPSite aSite = new SPSite(curSiteCtx.ID, spInToken))
05 {
06
07 }
08 }
09 private SPUserToken GetTheContext(SPSite nWeb)
10 {
11 nWeb.CatchAccessDeniedException = false;
12 SPUserToken spToken = null;
13 try
14 {
15 spToken = nWeb.SystemAccount.UserToken;
16 }
17 catch (UnauthorizedAccessException generatedExceptionName)
18 {
19
20 }
21 return spToken;
22 }

You need to ensure that users without permissions to the list can view the contents of the list from the Web Part.

Which code segment should you add at line 19?

Which code segment should you add at line 03?

You have a list named Projects that contains a column named ClassificationMetadata.

You need to create a Web Part that updates the ClassificationMetadata value to NA for each item in the Projects list.

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

01 foreach (SPListItem currentItem in SPContext.Current.Web.Lists[“Projects”].Items)
02 {
03
04 }

Which code segment should you add at line 03?

Which code segment should you add at line 03?

You need to create a Web Part that displays all of the content created by a specific user.
You write the following code segment. (Line numbers are included for reference only.)

01 FullTextSqlQuery qry = new FullTextSqlQuery(ServerContext.GetContext(SPContext.Current.Site));
02 qry.ResultTypes = ResultType.RelevantResults;
03
04 qry.QueryText = strQuery;
05 ResultTableCollection results = qry.Execute();

Which code segment should you add at line 03?

Which code segment should you add at line 04?

You need to create a Web Part that displays all of the content created by a specific user.
You write the following code segment. (Line numbers are included for reference only.)

01 private void keywordQueryExecute(string searchAuthor)
02 {
03 KeywordQuery kRequest = new KeywordQuery(ServerContext.Current);
04
05 kRequest.QueryText = strQuery;
06 ResultTableCollection resultTbls = kRequest.Execute();
07 }

Which code segment should you add at line 04?

Which code segment should you add to the application?

You need to create a custom application that provides users with the ability to create a managed property.

The managed property name must be specified in the args[1] parameter.

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

01 SPSite currentSite = new SPSite(“http://intranet”);
02 SearchContext context = SearchContext.GetContext(currentSite);
03 Schema schema = new Schema(context);

Which code segment should you add to the application?

Which code segment should you add at line 04?

You need to create a Web Part that adds a term set to the current SharePoint site collection’s term store.

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

01 System.Web.UI.WebControls.TextBox txtBoxTermSetToAdd = new System.Web.UI.WebControls.TextBox();
02 TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
03 TermSet addedTerm = session.TermStores[0].Groups[“MyNewTermStore”].CreateTermSet(txtBoxTermSetToAdd.Text);
04

Which code segment should you add at line 04?

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?


Page 9 of 18« First...7891011...Last »