我正在为 Dynamics CRM 2013 开发。我尝试更改 Quote 的状态,但似乎找不到 QuoteState。我尝试使用 QuoteState.Active,但出现错误:“名称 'QuoteState' 在当前上下文中不存在”。这些是我使用的命名空间:
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Crm.Sdk;
using Microsoft.Xrm.Client;
using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xrm;
我错过了什么命名空间或者我做错了什么?
编辑:
这是我试图使用它的功能:
/// <summary>
/// Activates the Quote
/// </summary>
/// <param name="quote">The quote</param>
/// <param name="xrm">The Xrm Service Context</param>
private static void ActivateQuote(Quote quote, XrmServiceContext xrm)
{
SetStateRequest activateQuote = new SetStateRequest()
{
EntityMoniker = quote.ToEntityReference(),
State = new OptionSetValue((int)QuoteState.Active),
Status = new OptionSetValue(3)
};
SetStateResponse activateResponse = (SetStateResponse)xrm.Execute(activateQuote);
// Save
xrm.SaveChanges();
Console.WriteLine("Activated the quote...");
}
如果我使用 State = new OptionSetValue(1) 它可以工作,所以只是缺少 QuoteState 。