示例#1
0
        public static Guid CreateAccount(CrmServiceClientAdapter client)
        {
            Guid newAccountId;

            Entity account = new Entity("account")
            {
                ["name"] = "Test 1234"
            };

            using (client)
            {
                newAccountId = client.Create(account);
            }

            return(newAccountId);
        }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                CrmServiceClient client = new CrmServiceClient(ConfigurationManager
                                                               .ConnectionStrings["CRMConnectionString"].ConnectionString);

                CrmServiceClientAdapter adapter = new CrmServiceClientAdapter(client);

                Guid callerId = GetCallerId(adapter);

                Guid newAccountId = CreateAccount(adapter);
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                string message = ex.Message;
                throw;
            }
        }
示例#3
0
 public static Guid GetCallerId(CrmServiceClientAdapter client)
 {
     return(client.CallerId);
 }