Esempio n. 1
0
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved UserFeed</returns>
        public UserFeed Query(UserQuery feedQuery)
        {
            try {
                Stream   feedStream = Query(feedQuery.Uri);
                UserFeed feed       = new UserFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllUsers)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return(feed);
            } catch (GDataRequestException e) {
                AppsException a = AppsException.ParseAppsException(e);
                throw a ?? e;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved UserFeed</returns>
        public UserFeed Query(UserQuery feedQuery)
        {
            try
            {
                Stream feedStream = Query(feedQuery.Uri);
                UserFeed feed = new UserFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllUsers)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return feed;
            }
            catch (GDataRequestException e)
            {
                AppsException a = AppsException.ParseAppsException(e);
                throw (a == null ? e : a);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Inserts a new user account entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UserEntry Insert(UserFeed feed, UserEntry entry) {
     try {
         return base.Insert(feed, entry) as UserEntry;
     } catch (GDataRequestException e) {
         AppsException a = AppsException.ParseAppsException(e);
         throw a ?? e;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Inserts a new user account entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UserEntry Insert(UserFeed feed, UserEntry entry)
 {
     try {
         return(base.Insert(feed, entry) as UserEntry);
     } catch (GDataRequestException e) {
         AppsException a = AppsException.ParseAppsException(e);
         throw a ?? e;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Retrieves the entry for the specified user.
        /// </summary>
        /// <param name="username">the username to retrieve</param>
        /// <returns>the UserEntry for this user</returns>
        public UserEntry RetrieveUser(string username)
        {
            UserQuery query = new UserQuery(domain);

            query.UserName = username;

            UserFeed feed = userAccountService.Query(query);

            // It's safe to access Entries[0] here, because the service will
            // have already thrown an exception if the username was invalid.
            return(feed.Entries[0] as UserEntry);
        }
Esempio n. 6
0
 public GDataTypes.GDataUserEntrys CreateUserEntrys(UserFeed _userFeed)
 {
     var _gDataUserEntrys = new GDataTypes.GDataUserEntrys();
     foreach (UserEntry _userEntry in _userFeed.Entries)
     {
         var _gDataUserEntry = new GDataTypes.GDataUserEntry();
         _gDataUserEntry.UserName = _userEntry.Login.UserName;
         _gDataUserEntry.Admin = _userEntry.Login.Admin;
         _gDataUserEntry.susspended = _userEntry.Login.Suspended;
         _gDataUserEntry.AgreedToTerms = _userEntry.Login.AgreedToTerms;
         _gDataUserEntry.ChangePasswordAtNextLogin = _userEntry.Login.ChangePasswordAtNextLogin;
         _gDataUserEntry.GivenName = _userEntry.Name.GivenName;
         _gDataUserEntry.FamilyName = _userEntry.Name.FamilyName;
         _gDataUserEntry.Limit = _userEntry.Quota.Limit;
         _gDataUserEntry.SelfUri = _userEntry.SelfUri.ToString();
         _gDataUserEntrys.Add(_gDataUserEntry);
     }
     return _gDataUserEntrys;
 }