Sharepoint 中新增 aspx页面,并在页面中新增web part

1. 用 sharepoint designer打开网站

2. 在指定位置右键新增 aspx页面,编辑

3. 插入以下HTML代码,修改其中的webpart为你要新增的webpart(如要修改webpart属性,可在designer中修改)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register tagprefix="KMSearch" namespace="KMSearch.KMSearch" assembly="KMSearch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cf158b89fcc604c5" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">

<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:ContentType msdt:dt="string">Page</mso:ContentType><mso:PublishingContact msdt:dt="string"></mso:PublishingContact><mso:PublishingContactPicture msdt:dt="string">, </mso:PublishingContactPicture><mso:Approval_x0020_Level msdt:dt="string"></mso:Approval_x0020_Level><mso:Categories msdt:dt="string"></mso:Categories><mso:Assigned_x0020_To msdt:dt="string"></mso:Assigned_x0020_To></mso:CustomDocumentProperties></xml><![endif]-->
<meta name="ProgId" content="SharePoint.WebPartPage.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>知识库搜索</title>

<meta http-equiv="X-UA-Compatible" content="IE=8"/>
 <meta name="GENERATOR" content="Microsoft SharePoint"/>
 <meta name="progid" content="SharePoint.WebPartPage.Document"/>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta http-equiv="Expires" content="0"/>
 <SharePoint:RobotsMetaTag runat="server"/>
 
 <SharePoint:CssLink runat="server" Version="4"/>
 <SharePoint:Theme runat="server"/>
 <SharePoint:ULSClientConfig runat="server"/>
 <script type="text/javascript">
     var _fV4UI = true;</script>
 <SharePoint:ScriptLink language="javascript" name="core.js" OnDemand="true" runat="server"/>
 <SharePoint:CustomJSUrl runat="server"/>
 <SharePoint:SoapDiscoveryLink runat="server"/>
 <SharePoint:SPShortcutIcon runat="server" IconUrl="/_layouts/images/favicon.ico"/>

 <SharePoint:SPHelpPageComponent Visible="false" runat="server"/>
</head>

<body>
<form id="form1" runat="server">
<div class="ms-wpselectlink">

<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />


<KMSearch:KMSearch runat="server" KMDocName="KMDoc" Description="My Visual WebPart" KMDocSite="http://test.rpc-asia.com/sites/CN" Title="KMSearch" ImportErrorMessage="无法导入此 Web 部件。" __MarkupType="vsattributemarkup" __WebPartId="{7583c10c-c728-4862-888b-375960ca2de4}" WebPart="true" __designer:IsClosed="false" id="g_7583c10c_c728_4862_888b_375960ca2de4"></KMSearch:KMSearch>

</div>
</form>
</body>

</html>

 


 
原文地址:https://www.cnblogs.com/Roy_Cao/p/2705252.html