Example #1
0
        /// <summary>
        /// Constructs an AppsService with the specified credentials
        /// for accessing provisioning feeds on the specified domain.
        /// </summary>
        /// <param name="domain">the domain to access</param>
        /// <param name="adminEmailAddress">the administrator's email address</param>
        /// <param name="adminPassword">the administrator's password</param>
        public AppsService(string domain, string adminEmailAddress, string adminPassword) {
            this.domain = domain;
            this.applicationName = "apps-" + domain;

            nicknameService = new NicknameService(applicationName);
            nicknameService.setUserCredentials(adminEmailAddress, adminPassword);

            userAccountService = new UserService(applicationName);
            userAccountService.setUserCredentials(adminEmailAddress, adminPassword);

            groupsService = new GroupsService(domain, applicationName);
            groupsService.setUserCredentials(adminEmailAddress, adminPassword);
        }
Example #2
0
        /// <summary>
        /// Constructs an AppsService with the specified Authentication Token
        /// for accessing provisioning feeds on the specified domain.
        /// </summary>
        /// <param name="domain">the domain to access</param>
        /// <param name="authenticationToken">the administrator's Authentication Token</param>
        public AppsService(string domain, string authenticationToken) {
            this.domain = domain;
            this.applicationName = "apps-" + domain;

            nicknameService = new NicknameService(applicationName);
            nicknameService.SetAuthenticationToken(authenticationToken);

            userAccountService = new UserService(applicationName);
            userAccountService.SetAuthenticationToken(authenticationToken);

            groupsService = new GroupsService(domain, applicationName);
            groupsService.SetAuthenticationToken(authenticationToken);
        }
Example #3
0
 public void Init()
 {
     service = new GroupsService("example.com", "apps-example.com");
 }
Example #4
0
        /// <summary>
        /// Send authorized queries to a Service-based library
        /// </summary>
        /// <param name="service"></param>
        private static void RunGroupsSample(OAuth2Parameters parameters, string domain) {
            try {
                GOAuth2RequestFactory requestFactory = new GOAuth2RequestFactory("apps", applicationName, parameters);

                GroupsService service = new GroupsService(domain, applicationName);
                service.RequestFactory = requestFactory;

                GroupFeed feed = service.RetrieveAllGroups();
                foreach (GroupEntry group in feed.Entries) {
                    Console.WriteLine(group.GroupName);
                }
            } catch (AppsException a) {
                Console.WriteLine("A Google Apps error occurred.");
                Console.WriteLine();
                Console.WriteLine("Error code: {0}", a.ErrorCode);
                Console.WriteLine("Invalid input: {0}", a.InvalidInput);
                Console.WriteLine("Reason: {0}", a.Reason);
            }
        }