如何使用CRM SDK删除解决方案?

时间:2013-03-15 15:10:45

标签: dynamics-crm-2011 dynamics-crm

道歉,如果这是非常明显的,但我找不到有关如何通过SDK从组织中删除解决方案的信息。

我已经使用ImportSolutionRequest对象成功完成了导入,但找不到删除解决方案的等价物。

1 个答案:

答案 0 :(得分:4)

MS在MSDN here

上有一个指南

从该链接

using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig))
{
    // This statement is required to enable early-bound type support.
    _serviceProxy.EnableProxyTypes();

    // Delete a solution
    QueryExpression queryImportedSolution = new QueryExpression
    {
        EntityName = Solution.EntityLogicalName,
        ColumnSet = new ColumnSet(new string[] { "solutionid", "friendlyname" }),
        Criteria = new FilterExpression()
    };
    queryImportedSolution.Criteria.AddCondition("uniquename", ConditionOperator.Equal, ImportedSolutionName);
    Solution ImportedSolution = (Solution)_serviceProxy.RetrieveMultiple(queryImportedSolution).Entities[0];
    _serviceProxy.Delete(Solution.EntityLogicalName, (Guid)ImportedSolution.SolutionId);
}