示例#1
0
        public static void Run()
        {
            try
            {
                // ExStart:AccessColorInfo
                GoogleTestUser User2 = new GoogleTestUser("user", "email address", "password", "clientId", "client secret");
                string         accessToken;
                string         refreshToken;
                GoogleOAuthHelper.GetAccessToken(User2, out accessToken, out refreshToken);

                using (IGmailClient client = GmailClient.GetInstance(accessToken, User2.EMail))
                {
                    ColorsInfo colors = client.GetColors();
                    Dictionary <string, Colors> palettes = colors.Calendar;

                    // Traverse the settings list
                    foreach (KeyValuePair <string, Colors> pair in palettes)
                    {
                        Console.WriteLine("Key = " + pair.Key + ", Color = " + pair.Value);
                    }
                    Console.WriteLine("Update Date = " + colors.Updated);
                }
                // ExEnd:AccessColorInfo
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }