创建共享点列表实例时添加 html 值
我创建了一个 Sharepoint 列表定义以及该定义的一个实例。在该实例中,我需要将一些 HTML 存储为列表实例中的字段值。我知道我可以通过 UI 执行此操作,但我需要在部署时创建此列表。当我将 HTML 值包装在 CDATA 标记中时,根本不会创建该项目。如果我只是将 HTML 与 XML 内联,则会出现部署错误。
Elements.xml:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="ListName"
OnQuickLaunch="TRUE"
TemplateType="10051"
Url="Lists/ListName"
Description="List Description">
<Data>
<Rows>
<Row>
<Field Name="Title">My Title</Field>
<Field Name="Value">
<p>Some HTML HERE</p>
<table border="1"; cellpadding="10";>
<tr style="font-family:Arial; font-size:10pt;">
<th>header1</th>
<th> ... </th>
</tr>
<tr style="font-family:Arial; font-size:8pt;">
<td>Vaue1</td>
<td> ... </td>
</tr>
</table>
</Field>
</Row>
</Rows>
</Data>
</ListInstance>
</Elements>
任何帮助将不胜感激。
I have created a Sharepoint list definition, and an instance of that definition. In the instance I need to store some HTML as the value of a field in my list instance. I know I can do this through the UI, but I need this list created on deployment. When I wrap my HTML value in CDATA tags, the item is simply not created. I get a deployment error if I Just have my HTML inline with my XML.
Elements.xml:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="ListName"
OnQuickLaunch="TRUE"
TemplateType="10051"
Url="Lists/ListName"
Description="List Description">
<Data>
<Rows>
<Row>
<Field Name="Title">My Title</Field>
<Field Name="Value">
<p>Some HTML HERE</p>
<table border="1"; cellpadding="10";>
<tr style="font-family:Arial; font-size:10pt;">
<th>header1</th>
<th> ... </th>
</tr>
<tr style="font-family:Arial; font-size:8pt;">
<td>Vaue1</td>
<td> ... </td>
</tr>
</table>
</Field>
</Row>
</Rows>
</Data>
</ListInstance>
</Elements>
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要对值进行 HTML 编码:
You need to HTML encode the value: