Показать сообщение отдельно
Старый 28.07.2009, 15:42   #5  
Inmate is offline
Inmate
Участник
 
11 / 10 (1) +
Регистрация: 20.07.2009
try
{
contract contract = new contract();
contract.title = "Основной";
contract.activeon = new CrmDateTime();
contract.activeon.Value = "01.01.2007";
contract.expireson = new CrmDateTime();
contract.expireson.Value = "01.01.2008";

Guid guid = new Guid("7AB935EF-A27A-DE11-A140-00155D007805");

ColumnSet cols = new ColumnSet();
cols.Attributes = new string[] { "name", "accountid", "accountnumber", "address1_line3" };
account account = (account)service.Retrieve(EntityName.account.ToString(), guid, cols);

Guid guid1 = new Guid("77ECDFDA-3E70-1049-B174-1352B981C5F2");

contract.contracttemplateid = new Lookup();
contract.contracttemplateid.type = EntityName.contracttemplate.ToString();
contract.contracttemplateid.Value = guid1;

contract.customerid = new Customer();
contract.customerid.type = EntityName.account.ToString();
contract.customerid.Value = account.accountid.Value;

Guid contractGuid = service.Create(contract);
}
catch (SoapException exc)
{
throw new Exception(exc.Detail.InnerText);
}

Исключение:

System.Exception не обработано
Message="\n 0x8004022d\n billingcustomerid is missing and required\n Platform\n"
Source="WWDCrm4"
StackTrace:
в WWDCrm4.Program.Main(String[] args) в C:\Documents and Settings\butkevicha\Desktop\WWDCrm4\WWDCrm4\Program.cs:строка 54
в System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
в System.Threading.ThreadHelper.ThreadStart()
InnerException: