我正在构建自定义内容查询Web部件以显示员工内容类型的汇总信息.此内容类型具有名为EmpPhoto的发布图像站点列.我的CQWP运行良好,我需要的所有站点列都可用.
我现在正在创建一个自定义的xsl模板来正确呈现信息但是使用EmpPhoto图像卡住了.
如果我使用代码:
<xsl:value-of select="@EmpPhoto" disable-output-escaping="yes" />
Run Code Online (Sandbox Code Playgroud)
...我得到了一个很好的正确渲染图像.但是我想为这个图像构建一个onmouseover事件,这种方法不起作用.
我想创建一个xsl变量来获取实际的图像URL然后构建我自己的html img并将onmouseover写入例如
<xsl:variable name="EmpPhotoUrl">
<xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
<xsl:with-param name="UrlColumnName" select="@EmpPhoto"/>
</xsl:call-template>
</xsl:variable>
Run Code Online (Sandbox Code Playgroud)
...
<img src="{$EmpPhotoUrl}" onmouseover="" alt="test" />
Run Code Online (Sandbox Code Playgroud)
但是,这不会从EmpPhoto站点列获取URL.我是xsl的新手,所以我可能会错过一个明显的解决方案!
任何帮助非常感谢,
强尼
像我之前的许多人一样,我正在尝试将多个参数传递给Web API项目.我尝试过在这个网站上提供的几种解决方案,但没有运气.我最近的失败迭代看起来如下:
public class UserDTO
{
public int userID;
public string username;
}
[HttpPost]
public string Post([FromBody]UserDTO userDTO)
{
return userDTO.userID.ToString() + " " + userDTO.username;
}
Run Code Online (Sandbox Code Playgroud)
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
var apiUrl = "http://localhost:55051/api/User/Post";
var userDTO = {
userID: 5,
username: "testuser"
};
$.ajax({
type: "POST",
url: apiUrl,
data: JSON.stringify(userDTO),
datatype: "json",
contenttype: "application/json; charset=utf-8"
)};
Run Code Online (Sandbox Code Playgroud)
Fiddler显示正确传递的JSON变量,在Raw视图中我可以看到:
{"userID":5,"username":"testuser"}
userID = 0
username = null …Run Code Online (Sandbox Code Playgroud) 我已在SharePoint网站上为"列表和库"配置了匿名访问.然后,我根据我的要求启用对单个列表/库的匿名访问.
这很好用,但我无法访问我希望被重定向到欢迎页面的根网站URL:
如果我将Web权限设置为"整个网站",我可以访问根URL,但我不想这样做.
我正在为我的网站配置网站定义,并在功能激活期间通过对象模型修改网站,例如
web.AnonymousPermMask64 = SPBasePermissions.Open;
web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.Update();
Run Code Online (Sandbox Code Playgroud)
...这是我已经成功使用的代码.
有谁知道如何允许匿名访问http:// servername?