有没有人在SharePoint Content Query XSL中嵌入C#代码? [英] Has anyone embedded C# code in a SharePoint Content Query XSL?

查看:96
本文介绍了有没有人在SharePoint Content Query XSL中嵌入C#代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有试过在内容查询XSL中调用嵌入式C#函数?



对象示例:



Has any ever tried calling an embedded C# function from within content query XSL?

Contrived example:

<msxsl:script language="C#" implements-prefix="user">
<![CDATA[

public string yoGabba(string aThing){

  return aThing + " gabba";

}

]]>
</msxsl:script>

<xsl:template name="EmbedExample_FAIL" match="Row[@Style='EmbedExample_FAIL']" mode="itemstyle">
  <xsl:value-of select="user:yoGabba(@Title)"/>
</xsl:template>





SharePoint日志中的例外是:





The exception in the SharePoint log is:

System.Xml.Xsl.XslTransformException: Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it.



鉴于我只有控制XSL而不是Web部件的底层代码,我只是出去了运气还是有某种方法?


Given that I only have "control" of the XSL and not the underlying code for the web part, am I simply out of luck or is there some way?

推荐答案

您无法通过EnableScript属性。为此,您需要启用它。这是一个安全功能,而不是你可以解决的问题。
You cannot get past the EnableScript property. For this to work, you'll need to enable it. It is a security feature and not one you can get around.


这篇关于有没有人在SharePoint Content Query XSL中嵌入C#代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆