开发者

How can I stop SharePoint from appending <mso:CustomDocumentProperties> to my output

开发者 https://www.devze.com 2022-12-28 20:35 出处:网络
I\'m trying to hack together an extra feature on top of a POC (smoke and mirrors demo). The POC is on SPS 2007 and I need to integrate with another system.

I'm trying to hack together an extra feature on top of a POC (smoke and mirrors demo). The POC is on SPS 2007 and I need to integrate with another system.

To facilitate part of this, I need to provide a JSONP endpoint.

I want this URL:

http://sharepoint:2024/Pages/SomeExternalSystem/Payload.aspx?callback=abc

To return this:

abc({ sampleField1: 开发者_JAVA百科"sampleData1", sampleField2: 234.56 });

It's all smoke and mirrors anyway, so I uploaded this file to SharePoint:

<%@ Page ContentType="text/javascript" Language="C#" %>
<%= Request.QueryString["callback"] %>({
  sampleField1: "sampleData1",
  sampleField2: 234.56
});

(And added a page parser rule to allow it to compile the code blocks.)

No matter what I seem to do, SharePoint emits this instead:

abc({
    sampleField1: "sampleData1",
    sampleField2: 234.56
});
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:PublishingContactPicture msdt:dt="string"></mso:PublishingContactPicture>
<mso:PublishingRollupImage msdt:dt="string"></mso:PublishingRollupImage>
<mso:Audience msdt:dt="string"></mso:Audience>
<mso:PublishingContactName msdt:dt="string"></mso:PublishingContactName>
<mso:ContentType msdt:dt="string">Page</mso:ContentType>
<mso:Comments msdt:dt="string"></mso:Comments>
<mso:PublishingContactEmail msdt:dt="string"></mso:PublishingContactEmail>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>

It's proving hard to Google for.


As an extreme hack, this works:

<%@ Page ContentType="text/javascript" Language="C#" %>
<%
    Response.Clear();
    Response.Write(Request.QueryString["callback"]);
    Response.Write("({ sampleField1: \"sampleData1\", sampleField2: 234.56 });");
    Response.Flush();
    Response.End();
%>
0

精彩评论

暂无评论...
验证码 换一张
取 消