gpt4 book ai didi

javascript - Dynamics Crm 365 webapi - 通过javascript发布网络资源

转载 作者:行者123 更新时间:2023-11-30 11:42:11 25 4
gpt4 key购买 nike

本文介绍了如何使用 javascript 和 soap 发布网络资源。

http://mileyja.blogspot.com.au/2011/05/how-to-publish-all-customizations-using.html

有没有办法通过 web api 在 javascript 中调用发布请求?

最佳答案

是的,使用 PublishAllXml 是完全可能的或 PublishXml Action 。您可以使用 CRMRESTBuilder轻松测试这些操作:

PublishAllXml 示例

var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.1/PublishAllXml", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
//Success - No Return Data - Do Something
alert("it worked!");
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();

PublishXml 示例(它将仅发布帐户实体):

var parameters = {};
parameters.ParameterXml = "<importexportxml><entities><entity>account</entity></entities></importexportxml>";

var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.1/PublishXml", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
//Success - No Return Data - Do Something
alert("it worked!");
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(parameters));

关于javascript - Dynamics Crm 365 webapi - 通过javascript发布网络资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42218151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com