有关CRM错误的更多详细信息:“解决方案清单导入:失败” [英] More details about CRM error : "Solution manifest import: FAILURE"

查看:179
本文介绍了有关CRM错误的更多详细信息:“解决方案清单导入:失败”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#为CRM创建导入/导出工具。
有时候,我遇到一个导入错误,我的捕获中只有解决方案清单导入:失败这条消息。我试图将它转换为它的类型(FaultException),但我没有更多细节。

I am creating an import / export tool for CRM using C#. Sometimes, I am facing to an import error, with only this message "Solution manifest import: FAILURE" in my catch. I tried to cast it to its type (FaultException), but I haven't any more details.

如果我直接在CRM中导入相同的文件,我有一个更好的错误消息(例如,这个例子:导入解决方案xxxx失败。你的系统中缺少以下组件[...])。

If I do the import of the same file directly in CRM, I have a better error message (this one for exemple : "Import of solution xxxx failed. The following components are missing in yout system [...]").

是有没有办法得到这个完整的消息?

Is there a way to get this complete message ?

这是我的代码:

try
{
    _serviceProxy.Execute(impSolReq);
}
catch (Exception ex)
{
    if (ex is FaultException<OrganizationServiceFault>)
        MessageBox.Show("Error during import. More details: " + ((FaultException<OrganizationServiceFault>)ex).Detail);
    else
        MessageBox.Show("Error during import. More details: " + ex.Message);
}

感谢您的回答!

推荐答案

使用 ImportSolutionRequest 导入Dynamics CRM解决方案。

Dynamics CRM solutions are imported using the ImportSolutionRequest.

ImportSolutionRequest 具有包含解决方案导入作业ID的属性。您需要此ID才能监视作业的进度并在导入失败时获取错误详细信息。

The ImportSolutionRequest has a property containing the ID of the solution import job. You need this ID to be able to monitor the progress of the job and to get error details when the import fails.

请求的实例化可能如下所示:

Instantiation of the request could look like this:

Guid importJobId = Guid.NewGuid();

var request = new ImportSolutionRequest
{
    ConvertToManaged = true,
    CustomizationFile = buffer, // a byte[] array holding the solution contents
    ImportJobId = importJobId,
    OverwriteUnmanagedCustomizations = true,
    PublishWorkflows = true,
    SkipProductUpdateDependencies = false
};

执行请求。发生导入错误时,您可以使用作业ID检索错误详细信息。

Execute the request. When an import error occurs, you can retrieve the error details using the job id.

try
{
    _service.Execute(request);
}
catch (FaultException<OrganizationServiceFault> ex)
{
    if (ex.Detail.ErrorCode == -2147188685) // ImportSolutionError
    {
        Entity job = _service.Retrieve("importjob", importJobId, new ColumnSet { AllColumns = true });
        // TODO: process job error details.
    }

    throw;
}

属性 importjob.data 包含一个XML文档,其中包含您要查找的详细信息。

Attribute importjob.data contains an XML document with the details you are looking for.

ImportSolutionRequest 同步执行,可以轻松计算退房手续。但是可以安全地忽略超时,因为导入过程继续在后台运行。您可以定期检索导入作业记录来跟踪进度。只要 importjob.completedon 属性为 null ,作业仍在运行。

The ImportSolutionRequest is executed synchronously and can easily time-out. Time-outs however can safely be ignored, because the import process continues to run in the background. You can track progress by retrieving the import job record at regular intervals. As long as attribute importjob.completedon is null, the job is still running.

这篇关于有关CRM错误的更多详细信息:“解决方案清单导入:失败”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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