- 浏览: 78929 次
文章分类
- 全部博客 (136)
- 我的技术资料收集 (98)
- 具体技术 (1)
- 的技术资料收集 (4)
- All Articles (1)
- 机器学习 Machine Learning (1)
- 网络编程 (1)
- java (2)
- ava (1)
- 零散技术 (1)
- C# (3)
- 技术资料收集 (1)
- CQRS (1)
- 数据库技术(MS SQL) (1)
- .Net微观世界 (1)
- Oracle SQL学习之路 (1)
- C/C++ (1)
- JS/JQ (1)
- Js封装的插件/实例/方法 (2)
- 敏捷个人 (2)
- Javascript (1)
- 程序设计---设计模式 (1)
- Bug (1)
- 未知分类 (1)
- 程序设计 (1)
- Sharepoint (1)
- Computer Graphic (1)
- IT产品 (1)
- [06]JS/jQuery (1)
- [07]Web开发 (1)
- .NET Solution (1)
- Android (3)
- 机器学习 (1)
- 系统框架设计 (1)
- Others (1)
- 算法 (1)
- 基于Oracle Logminer数据同步 (1)
- 网页设计 (1)
- 原创翻译 (1)
- EXTJS (1)
- Jqgrid (1)
- 云计算 (1)
最新评论
这里我把从网上搜集到的针对Sharepoint 70-573的有关练习进行系统的解析,整理成一个系列, 分期、分批次共享出来,供大家研究。
70-573考试注重的是"知道"相关知识点,而到了70-576则注重的是"应用"相关知识点;所以二者各有侧重。
这里需要事先申明的是: 1. 不要把本系列当成Sharepoint 70-573的应试题库。
2. Sharepoint学习不是以考证为目的,真正的掌握必须要通过大量工程实践来达到。
3. 但是,通过做练习,可以帮助我们加深对Sharepoint相关知识点的认知与掌握,不失为一个复习与整理Sharepoint知识的好方法。
4. 所有的题目都是英文版的,但不会影响大家对题意的理解。
5. 由于解析篇幅限制,每篇文章涉及到的题目不会太多,题目数量也不会一致。
6. 所有的题目都按: 问题,解析,答案,参考 4个部分进行组织
7. 本系列是边收集,边整理,边解析,边发布,边更新; 所以需要一定的时间才能完成。
8. 在本系列积累到一定数量时,我会提供清单目录,但在此之前如果有兴趣,你可以自行归纳整理。
下面开始我们的进程:
=====================================================================================================
Question 1
You have a helper method named CreateSiteColumn that contains the following code segment.
private static void CreateSiteColumn(SPWeb web, string columnName)
{
}
You need to add a new site column of type Choice to a SharePoint site by using the helper method.
Which code segment should you include in the helper method?
A. SPField field = new SPFieldChoice(System.web.Lists[0].Fields, columnName);
B. web.Fields.Add(columnName, SPFieldType.Choice, true);
C. web.Lists[0].Fields.Add(columnName, SPFieldType.Choice, True);
D. web.Lists[0].Views[0].ViewFields.Add(columnName);
解析:
本题的意图是向Sharepoint Site中添加一个新的Site Column。
Site Columns是Sharepoint网站的一个重要底层结构,它是一类可重用的列定义或模板,可以将其分配给一个或多个 SharePoint 网站的一个或多个列表(List)。一个Site Column是由几个属性定义的,包括名称及其字段类型。例如 Title这个Column,其名称就是Title,字段类型就是Text。
我们即可以通过Sharepoint的管理界面添加新的Site Column,也可以通过Sharepoint Designer添加新的Site Column,还可以通过代码添加,比如使用如下代码
(http://msdn.microsoft.com/zh-cn/library/ms472869.aspx)
using (SPWeb oWebsite = SPContext.Current.Site.AllWebs["MySite"])
{
SPFieldCollection collFields = oWebsite.Lists["MyList"].Fields;
collFields.Add("MyField", Microsoft.SharePoint.SPFieldType.Text,
true);
}
即指定某Sharepoint Site的某个列(List),使用List的Fileds属性的Add方法添加Site Column,在添加的方法中可指定新的SiteColumn的名字,类型以及是否必需包含数值。因此在提供的备选答案中,B是正确答案。
选项A:使用方式不对,SPFieldChoice 构造函数的使用定义如下:
SPFieldChoice(SPFieldCollection, String) Initializes a new instance of the SPFieldChoice class based on the specified field collection and field name.
SPFieldChoice(SPFieldCollection, String, String) Initializes a new instance of the SPFieldChoice class based on the specified field collection, type name, and display name.
很明显A选项的使用方法与使用参数是不对的,尤其是第二个参数应该是FieldName而非ColumnName。
如果要向一个List中添加Choice类型的Column则可以使用如下类似的代码:( 思路就是先向指定的List添加一个Choice类型的SiteColumn,再设置这个SiteColumn的备选项)
lstCustomList.Fields.Add("ABC", SPFieldType.Choice, false); //添加一个新的Field
lstCustomList.Update();
SPFieldChoice objChoiceCol = (SPFieldChoice)lstCustomList.Fields["ABC"]; //设置这个新添加Field的属性
string[] strdata = new string[2];
strdata[0] = "Open";
strdata[1] = "Close";
objChoiceCol.Choices.Add(strdata[0]);
objChoiceCol.Choices.Add(strdata[1]);
objChoiceCol.Update();
lstCustomList.Update();
选项C. 没有这种用法。Lists【】中应该是ListName或Guid, 而不是所谓的索引值。类似的用法参见如下代码
private static void CreateList(string listName)
{
using (var site = new SPSite(SiteUrl))
{
var web = site.RootWeb;
var listId = web.Lists.Add(listName, string.Empty, SPListTemplateType.GenericList);
var list = web.Lists[listId];
list.OnQuickLaunch = true;
list.Update();
var title = list.Fields["Title"];
title.Title = "Name";
title.Update();
var empFieldName = list.Fields.Add("Employee", SPFieldType.Boolean, false);
var rateFieldName = list.Fields.Add("Salary/Rate", SPFieldType.Currency, true);
var bioFieldName = list.Fields.Add("Bio", SPFieldType.Note, false);
var view = list.DefaultView;
view.ViewFields.Add(empFieldName);
view.ViewFields.Add(rateFieldName);
view.ViewFields.Add(bioFieldName);
view.Update();
}
选项D. 也没有这种用法,况且如果要向一个List的视图中新添加Column,也仅限于添加已经存在的Column到此SPViewFieldCollection中。所以本选项是不能实现向List中添加新的Site Column的。而向List中添加新的Column的代码如下:
SPSite oSiteCollection = SPContext.Current.Site;
using(SPWeb oWebsite = oSiteCollection.AllWebs["Website_Name"])
{
SPList oList = oWebsite.Lists["List_Name"];
SPView oView = oList.Views["All Items"];
SPViewFieldCollection collViewFields = oView.ViewFields;
collViewFields.Add("Created");
oView.Update();
}
所以本题目正确先项应该是B
=====================================================================================================
Qestion2:
You have a Web application that contains the following code segment.
private void CreatingSPSite()
{
SPSite siteCollection = null;
try
{
siteCollection = new SPSite("http://contoso.com");
}
finally
{
}
}
You need to prevent the code segment from causing a memory leak.
Which code segment should you add?
A.
if (siteCollection != null)
{
siteCollection.Close();
}
B.
if (siteCollection != null)
{
siteCollection.Dispose();
}
C.
siteCollection = null;
D.
siteCollection.WriteLocked = false;
解析:
这是一个考证关于Sharepoint代码内存泄露的问题,Sharepoint既然是构建于.NET Framework之上的,为什么还存在内存泄露呢?
这是因为某些Sharepoint的服务器对象(Services Objects) 如: SPSite, SPWeb 虽然是Managed Objects,但出于提高其运行效率的需要,它们内部的实现代码使用了某些UnManaged 的代码,因此,就造成了你需要自己去解决内存泄露的问题。
在本题的供选项中,C.D可以明显的排除,需要关注的就是A与B。
我们知道,Dispose与Close都可以用于释放内存,但Close方法只能用在你先自行创建了SPSite对象,然后再去释放它。如果你是引用(Reference)了一个SPSite对象,你就不能通过Close方法去释放它。
所以我们通常推荐使用Dispose方法来代替Close方法,因为在Dispose方法中最终还是调用了Close方法,但它是通过IDisposable接口来实现的,所以.NET Framework的垃圾回收机制会调用 Dispose方法来释放与此对象相关的内存。 因此本题目正确选项应该是B
相关参考:
http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.spsite.close.aspx
http://msdn.microsoft.com/zh-cn/library/aa973248(v=office.12).aspx
=====================================================================================================
Question 3
You deploy a custom Web Part named WebPart1 to a SharePoint site.
WebPart1 contains the following code segment. (Line numbers are included for reference only.)
01 protected void Page_Load(object sender, EventArgs e)
02 {
03 SPSite site = null;
04 try
05 {
06 SPSite site = new SPSite("http://www.contoso.com/default.aspx");
07 SPWeb web = site.OpenWeb();
08
09 ...
10 }
11 catch
12 {
13
14 }
15 finally
16 {
17
18 }
19 }
After you deploy WebPart1, users report that the pages on the site load slowly.
You retract WebPart1 from the site.
Users report that the pages on the site load without delay. You need to modify the code in WebPart1 to prevent the pages from loading slowly.
What should you do?
A.
Add the following line of code at line 08:
site.ReadOnly = true;
B.
Add the following line of code at line 13:
site.Dispose();
C.
Add the following line of code at line 17:
site.Dispose();
D.
Add the following line of code at line 17:
site.ReadOnly = true;
解析:
从题意分析,由于加载了一个用户定义的Webpart而使页面呈现缓慢,当然,对于一个Webpart而言可能有许多原因让页面呈现缓慢的,比如:当Webpart涉及到与后台数据库数据交换时,当Webpart与Webservice服务交互信息时……等等.
而从本题目提供的代码中,仅涉及到了一个SPSite对象的创建,所以题目本身就把Webpart呈现缓慢的原因约束于SPSite对象上。
对于A.D是把Site Collection设置只读,即:把Site Collection锁定,不再进行任何写入操作。此类操作并不影响页面的呈现,因为页面的呈现本来就是个读取的过程。
所以问题归结到SPSite对象所引起的内存泄漏上,解决此问题要通过Dispose方法实现,问题是Dispose方法的解决时机,显然,此方法应该放在Finally代码区,因为此区不管你整体代码是否出现异常都会最执行到这里,而如果仅放在Catch区,则当上面的代码段并无异常时,由SPSite引起的内存泄漏还是没有解决,因为此内存泄漏并不属于Error范畴,所以不会跳到Catch区进行解决。
所以本题目正确先项应该是C
发表评论
-
C#WebBrowser控件使用教程与技巧收集--苏飞收集 - sufeinet
2013-06-28 12:07 1013原帖地址:http://www.cnblogs.com/suf ... -
我要喷一个自认为很垃圾的网站架构 - 老赵【苏州】
2013-06-28 12:01 1078原帖地址:http://www.cnblogs.com/lao ... -
[翻译] Oracle Database 12c 新特性Multitenant - Cheney Shue
2013-06-28 11:43 588原帖地址:http://www.cnblogs.com/ese ... -
memcahd 命令操作详解 - 阿正-WEB
2013-06-28 11:37 428原帖地址:http://www.cnblogs.com/azh ... -
面向过程的代码符合大众的思维方式吗? - 史蒂芬.王
2013-06-27 10:28 549原帖地址:http://www.cnblogs.com/ste ... -
面向过程的代码符合大众的思维方式吗? - 史蒂芬.王
2013-06-27 10:28 523原帖地址:http://www.cnblogs.com/ste ... -
RPG游戏之组队测试 - zthua
2013-06-27 10:22 517原帖地址:http://www.cnblogs.com/zth ... -
IT人们给个建议 - SOUTHER
2013-06-26 14:06 486原帖地址:http://www.cnblogs.com/sou ... -
Java向前引用容易出错的地方 - 银河使者
2013-06-26 14:00 455原帖地址:http://www.cnblogs.com/nok ... -
使用Func<T1, T2, TResult> 委托返回匿名对象 - 灰身
2013-06-26 13:54 760原帖地址:http://www.cnblo ... -
【web前端面试题整理03】来看一点CSS相关的吧 - 叶小钗
2013-06-25 10:45 735原帖地址:http://www.cnblogs.com/yex ... -
Windows 8 动手实验系列教程 实验6:设置和首选项 - zigzagPath
2013-06-25 10:27 574原帖地址:http://www.cnblogs.com/zig ... -
闲聊可穿戴设备 - shawn.xie
2013-06-25 10:21 514原帖地址:http://www.cnblo ... -
CentOS下Mysql安装教程 - 小学徒V
2013-06-23 15:24 561原帖地址:http://www.cnblogs.com/xia ... -
vmware安装ubuntu12.04嵌套安装xen server(实现嵌套虚拟化) - skyme
2013-06-23 15:18 793原帖地址:http://www.cnblogs.com/sky ... -
之前专门为IE6、7开发的网站如何迁移到IE10及可能遇到的问题和相应解决方案汇总 - 海之澜
2013-06-23 15:12 899原帖地址:http://www.cnblogs.com/wuz ... -
Android学习笔记--解析XML之SAX - 承香墨影
2013-06-23 15:01 363原帖地址:http://www.cnblo ... -
SQL Server 性能优化之——T-SQL TVF和标量函数
2013-06-19 09:32 614原帖地址:http://www.cnblogs.com/Boy ... -
Nginx学习笔记(二) Nginx--connection&request
2013-06-19 09:26 605原帖地址:http://www.cnblogs.com/cod ... -
从郭美美霸气侧漏看项目管理之项目经理防身术
2013-06-19 09:20 460原帖地址:http://www.cnblogs.com/had ...
相关推荐
sharepoint学习 笔记 心得 日志
Professional-Microsoft-Search-SharePoint-2007-and-Search-Server-2008
微软推荐的SharePoint 2013-design-sample-corporate-portal-host-named-sites
SharePoint 2010 Six-in-One
SharePoint 2010开发实例精选-上传下载文件
python库。 资源全名:sharepoint-rest-api-0.4.1.tar.gz
Pass the exam 70-573 in Jan 2012 with 1000 points. Cover the exam 100%.
For more information about search processes and how search components interact, see Search Architectures for SharePoint® Server 2013 (http://go.microsoft.com/fwlink/p/?LinkId=258643).
SharePoint2013应用配置管理01-SharePoint2013介绍和部署,好资料你值得拥有
Create Sharepoint Site By Template in Code - Workflow Custom Activity sharepoint自动创建站点的脚本/工作流,支持sharepoint designer使用创建动作
SharePoint 2010 Business Intelligence 24-Hour Trainer
Beginning SharePoint 2007 Administration-Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007 Introduction Chapter 1 - Introduction to Microsoft SharePoint 2007 Chapter 2...
Beginning SharePoint 2007 Administration-Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007 Introduction Chapter 1 - Introduction to Microsoft SharePoint 2007 Chapter 2...
亮剑.NET:SharePoint Server 2007开发实战-2
sams teach yourself microsoft sharepoint 2003 in 10 minutes
SharePoint2010-AdminComp-SampleChapters
Wrox.Professional.SharePoint.2010.Cloud-Based.Solutions.2012
sharepoint 开发考试 70-542考题 翻译(中文),大家珍惜啊,这份考题在网上要花300块大洋!
SharePoint All-In-One Mega Guide