11. Januar 2010 21:22
using System;
using System.Collections.Generic;
using System.Text;
using updateMyQuote.CrmSdk;
namespace updateMyQuote
{
class Program
{
static CrmService service;
static void Main(string[] args)
{
updatequotedetail();
Console.ReadKey();
}
private static void updatequotedetail()
{
quotedetail detail = new quotedetail();
detail.description = "quote description right here";
detail.quoteid = new Lookup();
detail.quoteid.type = EntityName.quote.ToString();
detail.quoteid.Value = new Guid("908C0EA4-B8BD-DC11-8278-0003FFBE0BF0");
detail.productid = new Lookup();
detail.productid.type = EntityName.product.ToString();
detail.productid.Value = new Guid("6003BCAC-A299-DD11-A86D-0003FFBE0BF0");
CrmDecimal dec = new CrmDecimal();
dec.Value = (decimal) 1.0;
detail.quantity = dec;
detail.uomid = new Lookup();
detail.uomid.type = EntityName.uom.ToString();
detail.uomid.Value = new Guid("81896D87-A299-DD11-A86D-0003FFBE0BF0");
TargetCreateQuoteDetail target = new TargetCreateQuoteDetail();
target.QuoteDetail = detail;
CreateRequest create = new CreateRequest();
create.Target = target;
CreateResponse created = (CreateResponse)service.Execute(create);
}
private static void authenticate()
{
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "MicrosoftCRM";
service = new CrmService();
service.Credentials = new System.Net.NetworkCredential("administrator", "pass@word1", "");
service.CrmAuthenticationTokenValue = token;
service.Url = "http://192.168.15.170:5555/MSCrmServices/2007/CrmService.asmx";
}
}
}
11. Januar 2010 21:46