SharePoint 开发篇:浅谈Web Part和Page Layout 开发

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SharePoint 开发篇:浅谈Web Part和Page Layout 开发相关的知识,希望对你有一定的参考价值。

Blog链接:https://blog.51cto.com/13969817

Design Manager 帮助很多开发者在SharePoint中创建自己的网站设计。通常我们根据站点设计进行定制母版页,因为它定义了贯穿站点所有页面的公共元素,你可以通过“站点设置”下的“Design Manager”并映射你的网络驱动器,使用任何html编辑器编辑母版页。

比如,主页上的搜索框可以帮助用户在网站上找到视频,在配置搜索设置之后,从gallery中插入一个搜索框,然后从Design Manager导航到搜索设置,并添加搜索中心URL,更新搜索片段并复制HTML。

示例代码:<div id="s4-bodyContainer">

而Page Layout是通过在母版页的公共元素中设置页面字段和Web部件区域的样式来定义一组页面的外观,前面映射的网络驱动器可用于使用任何HTML编辑器编辑页面布局。

开发Page layout的时候使用Design Manager来开发,这种开发方式是直接写html文件,对于页面需要用到的元素(e.g. webpart zone),可以通过snippet的方式添加,这种方式得好处是开发比较快。
比如我想为Media Web Part添加Web Part Zone snippet。

示例参考代码:

<!--CS: Start Web Part Zone Snippet-->
<!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<div xmlns:ie="ie">
<!--MS:<WebPartPages:WebPartZone runat="server" AllowPersonalization="false" ID="x337a5a8d939248d49e9c39d87693bef0" FrameType="TitleBarOnly" Orientation="Vertical">-->
<!--MS:<ZoneTemplate>-->
<!--DC: Replace this comment with default web parts for new pages. -->
<!--ME:</ZoneTemplate>-->
<!--ME:</WebPartPages:WebPartZone>-->
</div>
<!--CE: End Web Part Zone Snippet-->

其他相关文章:Build your first SharePoint client-side web part (Hello World part 1)

以上是关于SharePoint 开发篇:浅谈Web Part和Page Layout 开发的主要内容,如果未能解决你的问题,请参考以下文章

SharePoint服务器端对象模型 完结

SharePoint服务器端对象模型 之 使用LINQ进行数据访问操作(Part 4)

SharePoint Online - 内容编辑器 Web 部件 - 机密管理

Office365 Sharepoint Web 服务失败

SharePoint Online 开发篇:SharePoint Hosted Apps获取用户ID

Office 365 SharePoint 迁移浅谈 SMAT 2013 介绍