Пример #1
0
        public void TestBatchRunnersWithSharedLogin()
        {
            var api = new BulkApiContext();
            api.Login(_UserName, _Password, _SecurityToken).Wait();

            var csv = File.ReadAllText("contactsupsert.csv");
            var b1 = new BatchRunner(api).Run(OperationType.upsert, "Contact", BulkContentType.CSV, csv, "CMS_Family_ID__c");

            var b2 = new BatchRunner(api).Run(OperationType.query, "Contact", BulkContentType.CSV, _SOQL, null);

            File.AppendAllText("results.csv", b1.Result);
            File.AppendAllText("results.csv", b2.Result);
        }
Пример #2
0
        public void TestUpsertContactsWithoutBatchRunner()
        {
            var csv = File.ReadAllText("contactsupsert.csv");
            var api = new BulkApiContext();
            api.Login(_UserName, _Password, _SecurityToken).Wait();
            var job = api.CreateJob(new JobCreationRequest { contentType = BulkContentType.CSV, Object = "Contact", operation = OperationType.upsert, externalIdFieldName= "CMS_Family_ID__c" }).Result;
            var batch = api.AddBatch(csv, job.id).Result;
            while (batch.state == BatchState.Queued)
            {
                Task.Delay(5000).Wait();
                batch = api.GetBatchStatus(batch).Result;
            }
            var results = api.GetBatchResult(batch.id, batch.jobId).Result;

            File.AppendAllText("results.csv", results);
        }
 private Task Login(string userName, string password, string securityToken)
 {
     _Api = new BulkApiContext();
     return _Api.Login(userName, password, securityToken);
 }
 public BatchRunner(BulkApiContext api)
 {
     _Api = api;
 }
 private Task Login(string userName, string password, string securityToken)
 {
     _Api = new BulkApiContext();
     return(_Api.Login(userName, password, securityToken));
 }
 public BatchRunner(BulkApiContext api)
 {
     _Api = api;
 }