Skip to content
This repository was archived by the owner on Jul 19, 2021. It is now read-only.

Example: campaign retrieval

Stefano Varesi edited this page Apr 9, 2015 · 2 revisions
using ContactLabAPIClient.ClabService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ContactLabApiClientExample
{
    public class GetCampaignById
    {
        public static void Main() {

            ClabServiceClient ClabServiceClient = null;
            int CampaignId = 811;
            ClabServiceClient = new ClabServiceClient();
            Campaign campaign = null;

            try
            {
                AuthToken Token = ClabServiceClient.borrowToken(ContactlabApiClientExamples.Properties.Settings.Default.ApiKey,
                    ContactlabApiClientExamples.Properties.Settings.Default.UserKey);
       
                campaign = ClabServiceClient.getCampaign(Token, CampaignId);

                ClabServiceClient.invalidateToken(Token);

                Console.WriteLine("Campaign id is " + campaign.identifier + " with name " + campaign.name);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception with message: \" " + e.Message + "\"");
            }

            Console.ReadLine();
        }
    }
}

Clone this wiki locally