当前位置: 首页>>代码示例>>C#>>正文


C# Api.Consent方法代码示例

本文整理汇总了C#中Api.Consent方法的典型用法代码示例。如果您正苦于以下问题:C# Api.Consent方法的具体用法?C# Api.Consent怎么用?C# Api.Consent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api.Consent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var api = new Api(Settings.Default.DomainKey, Settings.Default.DomainPassword);

            var consent = api.Consent(ContactSource.Gmail);

            Process.Start(consent.Url);

            bool complete = false;
            while (!complete)
            {
                var events = api.Events(consent.ImportId);

                foreach (var item in events.Events)
                    Console.WriteLine("{0}-{1}", item.Type, item.Status);

                complete = events.IsComplete;
            }

            var contacts = api.Contacts(consent.ImportId);

            foreach (var item in contacts.Contacts)
                Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
        }
开发者ID:cloudsponge,项目名称:cloudsponge-lib-net,代码行数:24,代码来源:Program.cs

示例2: GetFriendsEmail

        public List<string> GetFriendsEmail(string mailType)
        {
            List<string> lstEmail = new List<string>();
            try
            {
                try
                {
                    //Client ID 	767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com
                    //Client secret 	DQNCzBuiwo0U58rkAbo38Jvs

                    string domainKey = ConfigurationSettings.AppSettings["DomainKey"];
                    string domainPassword = ConfigurationSettings.AppSettings["DomainPassword"];

                    //var api = new Api(Settings.Default.DomainKey, Settings.Default.DomainPassword);

                    var api = new Api(domainKey, domainPassword);

                    //var api = new Api("QHBFU6D43BDCTQJT3XVZ", "vtFIAaMaGkSYVZMY");

                    //var consent = api.Consent(ContactSource.Gmail);

                    ConsentResponse consent = null;

                    if (mailType == "gmail")
                    {
                        consent = api.Consent(ContactSource.Gmail);
                    }

                    if (mailType == "yahoo")
                    {
                        consent = api.Consent(ContactSource.Yahoo);
                    }

                    if (mailType == "hotmail")
                    {
                        consent = api.Consent(ContactSource.WindowsLive);
                    }
                    

                    //Process.Start("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&redirect_uri=https%3A%2F%2Fapi.cloudsponge.com%2Fauth&state=import_id%3D30938548");
                    Process.Start(consent.Url);

                    bool complete = false;
                    while (!complete)
                    {
                        var events = api.Events(consent.ImportId);

                        foreach (var item in events.Events)
                            Console.WriteLine("{0}-{1}", item.Type, item.Status);

                        complete = events.IsComplete;
                    }

                    var contacts = api.Contacts(consent.ImportId);

                    foreach (var item in contacts.Contacts)
                    {
                        try
                        {
                            Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
                            string emailAddresses = item.FirstName + "<~>" + item.LastName + "<~>" + item.EmailAddresses.FirstOrDefault();
                            lstEmail.Add(emailAddresses);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Error : " + ex.StackTrace);
                        }
                    }
                }
                catch (Exception)
                {

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return lstEmail;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:80,代码来源:GatherEmailByCloudSponge.cs

示例3: GetFriendsEmail

        public string GetFriendsEmail(string mailType)
        {
            string res = string.Empty;
            List<string> lstEmail = new List<string>();
            try
            {
                try
                {
                    //Client ID 	767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com
                    //Client secret 	DQNCzBuiwo0U58rkAbo38Jvs

                    //string domainKey = ConfigurationSettings.AppSettings["DomainKey"];
                    //string domainPassword = ConfigurationSettings.AppSettings["DomainPassword"];

                    string domainKey = "BTUU28Y8FTW4UTXL44B8";
                    string domainPassword = "Yes6cLblk3lf4jWt"; 

                    //var api = new Api(Settings.Default.DomainKey, Settings.Default.DomainPassword);

                    var api = new Api(domainKey, domainPassword);

                    //var api = new Api("QHBFU6D43BDCTQJT3XVZ", "vtFIAaMaGkSYVZMY");

                    //var consent = api.Consent(ContactSource.Gmail);

                    ConsentResponse consent = null;

                    if (mailType == "gmail")
                    {
                        consent = api.Consent(ContactSource.Gmail);
                    }

                    if (mailType == "yahoo")
                    {
                        consent = api.Consent(ContactSource.Yahoo);
                    }

                    if (mailType == "hotmail")
                    {
                        consent = api.Consent(ContactSource.WindowsLive);
                    }


                    //Process.Start("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&redirect_uri=https%3A%2F%2Fapi.cloudsponge.com%2Fauth&state=import_id%3D30938548");


                    //Process.Start(consent.Url);
                    try
                    {
                        //new Thread(() =>
                        //{
                        //    GetContext(lstEmail, api, consent);
                        //}).Start();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }
                    try
                    {
                       // Response.Write(consent.Url);
                        //Response.Redirect(consent.Url);
                        //Response.Redirect(consent.Url, true);
                        //Server.Transfer(consent.Url);

                        ///open url in new tab using javascript
                        //string url = "https://www.google.co.in";
                        ////string s = "window.open('" + url + "', '_blank', 'width=300,height=100,left=100,top=100,resizable=yes');";
                        //string s = "window.open('" + url + "', '_blank');";
                        //ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);

                        Session["api"] = api;
                        Session["consent"] = consent;

                        //Response.Write("Successcloudspongeseperator");
                        

                       // Response.Write(consent.Url);
                        //Response.Write("http://www.google.com");
                       res=consent.Url;

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }


                    
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error : " + ex.StackTrace);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return res;
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:socioboard,代码行数:101,代码来源:AjaxInviteFrndsByCloudSponge.aspx.cs


注:本文中的Api.Consent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。