/// <summary>
    /// submit an async job to translate a document library
    /// </summary>
    /// <param name="culture">target langauge</param>
    /// <param name="inputList">Full URL of the input document library on SharePoint</param>
    /// <param name="outputList">Full URL of the output document library on SharePoint</param>
    static void AddAsyncLibrary(string culture, string inputList, string outputList)
    {
        SPServiceContext sc  = SPServiceContext.GetContext(new SPSite(site));
        TranslationJob   job = new TranslationJob(sc, CultureInfo.GetCultureInfo(culture));

        using (SPSite siteIn = new SPSite(inputList))
        {
            Console.WriteLine("In site: {0}", siteIn);
            using (SPWeb webIn = siteIn.OpenWeb())
            {
                Console.WriteLine("In web: {0}", webIn);
                using (SPSite siteOut = new SPSite(outputList))
                {
                    Console.WriteLine("Out site: {0}", siteOut);
                    using (SPWeb webOut = siteOut.OpenWeb())
                    {
                        Console.WriteLine("Out web: {0}", webOut);
                        SPDocumentLibrary listIn  = (SPDocumentLibrary)webIn.GetList(inputList);
                        SPDocumentLibrary listOut = (SPDocumentLibrary)webOut.GetList(outputList);
                        Console.WriteLine("Input: " + listIn);
                        Console.WriteLine("Output: " + listOut);
                        job.AddLibrary(listIn, listOut);
                        Console.WriteLine("Submitting the job");
                        job.Start();
                        ListJobItemInfo(job);
                    }
                }
            }
        }
    }
 private void asyncLib_Click(object sender, RoutedEventArgs e)
 {
     CreateClientContext();
     List inList = cc.Web.Lists.GetByTitle(this.inputFile.Text);
     List outList = cc.Web.Lists.GetByTitle(this.outputFile.Text);
     TranslationJob job = new TranslationJob(cc, this.culture.Text);
     job.AddLibrary(inList, outList);
     job.Start();
     cc.Load(job);
     ThreadPool.QueueUserWorkItem(new WaitCallback(CreateThreadForAsync), job);
 }
        private void asyncLib_Click(object sender, RoutedEventArgs e)
        {
            CreateClientContext();
            List           inList  = cc.Web.Lists.GetByTitle(this.inputFile.Text);
            List           outList = cc.Web.Lists.GetByTitle(this.outputFile.Text);
            TranslationJob job     = new TranslationJob(cc, this.culture.Text);

            job.AddLibrary(inList, outList);
            job.Start();
            cc.Load(job);
            ThreadPool.QueueUserWorkItem(new WaitCallback(CreateThreadForAsync), job);
        }
 static void AsyncLib(string culture, string inputList, string outputList, string name)
 {
     List inList = cc.Web.Lists.GetByTitle(inputList);
     List outList = cc.Web.Lists.GetByTitle(outputList);
     TranslationJob job = new TranslationJob(cc, culture);
     job.AddLibrary(inList, outList);
     job.Name = name;
     job.Start();
     cc.Load(job);
     cc.ExecuteQuery();
     Console.WriteLine("JobId: " + job.JobId);
     Console.WriteLine("JobName: " + job.Name);
     Console.WriteLine("Done");
 }
        static void AsyncLib(string culture, string inputList, string outputList, string name)
        {
            List           inList  = cc.Web.Lists.GetByTitle(inputList);
            List           outList = cc.Web.Lists.GetByTitle(outputList);
            TranslationJob job     = new TranslationJob(cc, culture);

            job.AddLibrary(inList, outList);
            job.Name = name;
            job.Start();
            cc.Load(job);
            cc.ExecuteQuery();
            Console.WriteLine("JobId: " + job.JobId);
            Console.WriteLine("JobName: " + job.Name);
            Console.WriteLine("Done");
        }
 /// <summary>
 /// submit an async job to translate a document library
 /// </summary>
 /// <param name="culture">target langauge</param>
 /// <param name="inputList">Full URL of the input document library on SharePoint</param>
 /// <param name="outputList">Full URL of the output document library on SharePoint</param>
 static void AddAsyncLibrary(string culture, string inputList, string outputList)
 {
     SPServiceContext sc = SPServiceContext.GetContext(new SPSite(site));
     TranslationJob job = new TranslationJob(sc, CultureInfo.GetCultureInfo(culture));
     using (SPSite siteIn = new SPSite(inputList))
     {
         Console.WriteLine("In site: {0}", siteIn);
         using (SPWeb webIn = siteIn.OpenWeb())
         {
             Console.WriteLine("In web: {0}", webIn);
             using (SPSite siteOut = new SPSite(outputList))
             {
                 Console.WriteLine("Out site: {0}", siteOut);
                 using (SPWeb webOut = siteOut.OpenWeb())
                 {
                     Console.WriteLine("Out web: {0}", webOut);
                     SPDocumentLibrary listIn = (SPDocumentLibrary)webIn.GetList(inputList);
                     SPDocumentLibrary listOut = (SPDocumentLibrary)webOut.GetList(outputList);
                     Console.WriteLine("Input: " + listIn);
                     Console.WriteLine("Output: " + listOut);
                     job.AddLibrary(listIn, listOut);
                     Console.WriteLine("Submitting the job");
                     job.Start();
                     ListJobItemInfo(job);
                 }
             }
         }
     }
 }