设为首页 收藏本站
查看: 596|回复: 0

[经验分享] MOSS 2010:Visual Studio 2010开发体验(1)——SharePoint Explorer

[复制链接]

尚未签到

发表于 2015-9-28 11:29:41 | 显示全部楼层 |阅读模式
  你不得不感概,原先在MOSS 2007的时代我们是多么辛苦。不是吗?


  • Visual Studio 开发体验受到局限
    适用于 WSS 的 Visual Studio 扩展
    Visual Studio Tools for Office 与 VS2008 之间的配合
    SharePoint 开发人员需要依赖于社区工具
  • 开发人员不得不应对层出不穷的细节工作
    手工编辑 CAML 文件
    熟悉 WSS 的 RootFiles 目录
    手工编辑 manifest.xml 文件
    为解决方案包构建 .wsp 文件
  
  是的 ,对这些痛苦我们记忆犹新。好吧,现在是时候改变了


  • SharePoint 2010 采用端到端的开发体验
    用于浏览网站的 SharePoint Explorer
    SharePoint 2010 项目与组件模板
    适用于各种主要应用场景的可视化设计环境
    为 Visual Studio 2008 for WSS 3.0 提供迁移路径
    可由第三方开发人员进行扩展
  • SharePoint 开发人员的好消息
    实现 RootFiles 目录细节的简化
    实现 .wsp 文件构建工作的简化
    减少/避免对外部工具的使用需求
  
  当然,前提是,你得拥有Visual Studio 2010,而且最好是装在服务器上面。听我的吧,这样可以避免很多问题,节省大量的时间。
这一讲介绍一下SharePoint Explorer
  这个工具是集成在Server Explorer中的
DSC0000.png
DSC0001.png
  很显然有了这个工具,就可以更好地理解一个SharePoint站点的结构了。目前这个工具,除了让开发人员更好地浏览SharePoint站点内容结构之外,如果我们在Lists上面去点击右键的话,还可以直接点位到该列表
DSC0002.png
  
  我觉得这个工具还不是很完善,以后可能会更加强一些。例如直接可以拖拽到程序界面上这样的功能
  
  关于 Explorer的扩展,如果有兴趣的朋友,可以参考下面的链接
  http://msdn.microsoft.com/en-us/library/ee471438(VS.100).aspx
  
  下面是有一个例子
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Windows.Forms;
using Microsoft.VisualStudio.SharePoint;
using Microsoft.VisualStudio.SharePoint.Explorer;
using Microsoft.VisualStudio.SharePoint.Explorer.Extensions;
namespace Contoso.ServerExplorerExtension
{
[Export(typeof(IExplorerNodeTypeExtension))]
[ExplorerNodeType(ExplorerNodeTypes.SiteNode)]
internal class SiteNodeExtensionWithContextMenu : IExplorerNodeTypeExtension
{
public void Initialize(IExplorerNodeType nodeType)
{
nodeType.NodeMenuItemsRequested += nodeType_NodeMenuItemsRequested;
}
void nodeType_NodeMenuItemsRequested(object sender, ExplorerNodeMenuItemsRequestedEventArgs e)
{
IMenuItem menuItem = e.MenuItems.Add("Display Message");
menuItem.Click += menuItem_Click;
}
void menuItem_Click(object sender, MenuItemEventArgs e)
{
IExplorerNode node = (IExplorerNode)e.Owner;
MessageBox.Show(string.Format("Clicked the menu item for the '{0}' node.", node.Text));
}
}
[Export(typeof(IExplorerNodeTypeExtension))]
[ExplorerNodeType(ExtensionNodeTypes.FieldNode)]
internal class FieldNodeExtensionWithProperty : IExplorerNodeTypeExtension
{
public void Initialize(IExplorerNodeType nodeType)
{
nodeType.NodePropertiesRequested += nodeType_NodePropertiesRequested;
}
void nodeType_NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e)
{
// Only add the property to "Body" fields.
if (e.Node.Text == "Body")
{
ExampleProperty propertyObject;
// If the properties object already exists for this node, get it from the node's annotations.
if (!e.Node.Annotations.TryGetValue(out propertyObject))
{
// Otherwise, create a new properties object and add it to the annotations.
propertyObject = new ExampleProperty(e.Node);
e.Node.Annotations.Add(propertyObject);
}
e.PropertySources.Add(propertyObject);
}
}
}
internal class ExampleProperty
{
private IExplorerNode node;
private const string propertyId = "Contoso.ExampleProperty";
private const string propertyDefaultValue = "This is an example property.";
internal ExampleProperty(IExplorerNode node)
{
this.node = node;
}
// Gets or sets a simple string property.
[DisplayName("ContosoExampleProperty")]
[DescriptionAttribute("This is an example property for field nodes.")]
[DefaultValue(propertyDefaultValue)]
public string TestProperty
{
get
{
string propertyValue;
// Get the current property value if it already exists; otherwise, return a default value.
if (!node.Annotations.TryGetValue(propertyId, out propertyValue))
{
propertyValue = propertyDefaultValue;
}
return propertyValue;
}
set
{
if (value != propertyDefaultValue)
{
// Store the property value in the Annotations property of the node.
// Data in the Annotations property does not persist when Visual Studio exits.
node.Annotations[propertyId] = value;
}
else
{
// Do not save the default value.
node.Annotations.Remove(propertyId);
}
}
}
}
}

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-119933-1-1.html 上篇帖子: 发布一个SharePoint 2010 工具(复制,移动文件和文件夹) 下篇帖子: SharePoint 2013 创建 Site Collection
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表