コード例 #1
0
        public void SaveAndReadTest()
        {
            entry.Properties.Add(new PropertyElement("name", "value")); 

            StringBuilder sb = new StringBuilder();
            XmlWriter writer = new XmlTextWriter(new StringWriter(sb));
            entry.SaveToXml(writer);
            writer.Close();

            XmlDocument document = new XmlDocument();
            document.LoadXml(sb.ToString());

            AppsExtendedEntry newEntry = new AppsExtendedEntry();
            foreach (XmlNode node in document.FirstChild.ChildNodes)
            {
                ExtensionElementEventArgs args = new ExtensionElementEventArgs();
                args.ExtensionElement = node;
                args.Base = newEntry;
                newEntry.Parse(args, new AtomFeedParser());
            }
            
            Assert.AreEqual(entry.Properties[0].Name, newEntry.Properties[0].Name,
                "Parsed entry should have same name for property[0] as original entry");
            Assert.AreEqual(entry.Properties[0].Value, newEntry.Properties[0].Value,
                "Parsed entry should have same value for property[0] as original entry");
        }
コード例 #2
0
        /// <summary>
        /// Creates a new calendar resource. A
        /// <a href="http://code.google.com/apis/apps/calendar_resource/docs/1.0/calendar_resource_developers_guide_protocol.html#naming_strategy">
        /// good naming strategy</a> is strongly suggested for resources.
        ///
        /// </summary>
        /// <param name="resourceId">a unique name you give this resource. This is a required
        /// property. The maximum length is 64 characters.</param>
        /// <param name="commonName">is the resource name seen by users in a calendar's resource
        /// list. This is an optional property when creating a resource, but is strongly
        /// recommended. This name has a maximum of 100 characters.</param>
        /// <param name="description">a brief summary of this resource shown in the control panel.
        /// This is an optional property, but is strongly recommended. The description is limited
        /// to a maximum of 1,000 characters.</param>
        /// <param name="type">is a general category common to several resources. This is an
        /// optional property, but is strongly recommended. The type name has a maximum of
        /// 100 characters.</param>
        /// <returns>newly created <code>AppsExtendedEntry</code> instance.</returns>
        public AppsExtendedEntry CreateCalendarResource(string resourceId, string commonName,
                                                        string description, string type)
        {
            Uri calendarResourceUri = new Uri(String.Format("{0}/{1}",
                                                            AppsCalendarResourceNameTable.AppsCalendarResourceBaseFeedUri, DomainName));
            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.Properties.Add(
                new PropertyElement(
                    AppsCalendarResourceNameTable.resourceId, resourceId));
            if (!String.IsNullOrEmpty(commonName))
            {
                entry.Properties.Add(
                    new PropertyElement(
                        AppsCalendarResourceNameTable.resourceCommonName, commonName));
            }
            if (!String.IsNullOrEmpty(description))
            {
                entry.Properties.Add(
                    new PropertyElement(
                        AppsCalendarResourceNameTable.resourceDescription, description));
            }
            if (!String.IsNullOrEmpty(type))
            {
                entry.Properties.Add(
                    new PropertyElement(
                        AppsCalendarResourceNameTable.resourceType, type));
            }
            return(base.Insert(calendarResourceUri, entry) as AppsExtendedEntry);
        }
コード例 #3
0
        /// <summary>
        /// Updates the given user
        /// </summary>
        /// <param name="domain">The user's domain</param>
        /// <param name="userEmail">The user's email address</param>
        /// <param name="attributes">The set of attributes to update</param>
        /// <returns>The updated user</returns>
        public AppsExtendedEntry UpdateDomainUser(String domain, String userEmail, IDictionary <MultiDomainUserProperty, String> attributes)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String            uri   = String.Format("{0}/{1}/{2}",
                                                    AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain, userEmail);

            entry.EditUri = new Uri(uri);

            foreach (KeyValuePair <MultiDomainUserProperty, String> mapEntry in attributes)
            {
                String value = mapEntry.Value;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                switch (mapEntry.Key)
                {
                case MultiDomainUserProperty.FirstName:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.FirstName, value));
                    break;

                case MultiDomainUserProperty.IpWhitelisted:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IpWhitelisted, value));
                    break;

                case MultiDomainUserProperty.IsAdmin:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsAdmin, value));
                    break;

                case MultiDomainUserProperty.IsChangePasswordAtNextLogin:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsChangePasswordAtNextLogin, value));
                    break;

                case MultiDomainUserProperty.IsSuspended:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsSuspended, value));
                    break;

                case MultiDomainUserProperty.LastName:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.LastName, value));
                    break;

                case MultiDomainUserProperty.NewEmail:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.NewEmail, value));
                    break;

                case MultiDomainUserProperty.Password:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.Password, value));
                    break;

                case MultiDomainUserProperty.UserEmail:
                    entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, value));
                    break;

                default:
                    break;
                }
            }
            return(Update(entry));
        }
コード例 #4
0
ファイル: auditservice.cs プロジェクト: Zelxin/RPiKeg
 /// <summary>
 /// Upload a public key for signing mailbox dump archives. This public encryption key should be a PGP format ascii-encoded RSA key.
 /// Before uploading the public key, convert it to a base64 encoded string.
 /// </summary>
 /// <param name="base64encodedKey">The base64-encoded, PGP format ASCII read RSA key</param>
 /// <returns>The inserted entry</returns>
 public AppsExtendedEntry UploadPublicKey(String base64encodedKey) {
     Uri keyUri = new Uri(String.Format("{0}/{1}/{2}",
                                        AuditNameTable.AuditBaseFeedUri,
                                        AuditNameTable.publicKeyUri,
                                        domain));
     AppsExtendedEntry entry = new AppsExtendedEntry();
     entry.Properties.Add(new PropertyElement(AuditNameTable.publicKeyProperty, base64encodedKey));
     return Insert(keyUri, entry);
 }
コード例 #5
0
        /// <summary>
        /// Renames an existing user
        /// </summary>
        /// <param name="domain">The user's domain</param>
        /// <param name="userEmail">Current user's email address</param>
        /// <param name="newEmail">New user's email address</param>
        /// <returns>The renamed user</returns>
        public AppsExtendedEntry RenameDomainUser(String domain, String userEmail, String newEmail)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String            uri   = String.Format("{0}/{1}/{2}",
                                                    AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain, userEmail);

            entry.EditUri = new Uri(uri);
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.NewEmail, newEmail));
            return(Update(entry));
        }
コード例 #6
0
        /// <summary>
        /// Creates an alias for an user in the domain
        /// </summary>
        /// <param name="domain">The user's domain</param>
        /// <param name="userEmail">The user's email address</param>
        /// <param name="aliasEmail">The alias to be added to the user</param>
        /// <returns>The created alias</returns>
        public AppsExtendedEntry CreateDomainUserAlias(String domain, String userEmail, String aliasEmail)
        {
            Uri userUri = new Uri(String.Format("{0}/{1}",
                                                AppsMultiDomainNameTable.AppsMultiDomainAliasBaseFeedUri, domain));

            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, userEmail));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.AliasEmail, aliasEmail));
            return(Insert(userUri, entry));
        }
コード例 #7
0
        /// <summary>
        /// Upload a public key for signing mailbox dump archives. This public encryption key should be a PGP format ascii-encoded RSA key.
        /// Before uploading the public key, convert it to a base64 encoded string.
        /// </summary>
        /// <param name="base64encodedKey">The base64-encoded, PGP format ASCII read RSA key</param>
        /// <returns>The inserted entry</returns>
        public AppsExtendedEntry UploadPublicKey(String base64encodedKey)
        {
            Uri keyUri = new Uri(String.Format("{0}/{1}/{2}",
                                               AuditNameTable.AuditBaseFeedUri,
                                               AuditNameTable.publicKeyUri,
                                               domain));
            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.Properties.Add(new PropertyElement(AuditNameTable.publicKeyProperty, base64encodedKey));
            return(Insert(keyUri, entry));
        }
コード例 #8
0
        /// <summary>
        /// Create a new organization unit under the given parent.
        /// </summary>
        /// <param name="customerId">The unique Id of the customer retrieved through customer feed.</param>
        /// <param name="orgUnitName">The new organization name.</param>
        /// <param name="parentOrgUnitPath">The path of the parent organization unit where 
        /// '/' denotes the root of the organization hierarchy. 
        /// For any OrgUnits to be created directly under root, specify '/' as parent path.</param>
        /// <param name="description">A description for the organization unit created.</param>
        /// <param name="blockInheritance">If true, blocks inheritance of policies from 
        /// parent units.</param>
        /// <returns></returns>
        public AppsExtendedEntry CreateOrganizationUnit(String customerId, String orgUnitName,
            String parentOrgUnitPath, String description, bool blockInheritance)
        {
            Uri orgUnitUri = new Uri(String.Format("{0}/{1}",
                AppsOrganizationNameTable.AppsOrgUnitBaseFeedUri, customerId));

            AppsExtendedEntry entry = new AppsExtendedEntry();
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.ParentOrgUnitPath, parentOrgUnitPath));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.Description, description));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OrgUnitName, orgUnitName));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.BlockInheritance, blockInheritance.ToString()));
            return Insert(orgUnitUri, entry); ;
        }
コード例 #9
0
        /// <summary>
        /// Create a new organization unit under the given parent.
        /// </summary>
        /// <param name="customerId">The unique Id of the customer retrieved through customer feed.</param>
        /// <param name="orgUnitName">The new organization name.</param>
        /// <param name="parentOrgUnitPath">The path of the parent organization unit where
        /// '/' denotes the root of the organization hierarchy.
        /// For any OrgUnits to be created directly under root, specify '/' as parent path.</param>
        /// <param name="description">A description for the organization unit created.</param>
        /// <param name="blockInheritance">If true, blocks inheritance of policies from
        /// parent units.</param>
        /// <returns></returns>
        public AppsExtendedEntry CreateOrganizationUnit(String customerId, String orgUnitName,
                                                        String parentOrgUnitPath, String description, bool blockInheritance)
        {
            Uri orgUnitUri = new Uri(String.Format("{0}/{1}",
                                                   AppsOrganizationNameTable.AppsOrgUnitBaseFeedUri, customerId));

            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.ParentOrgUnitPath, parentOrgUnitPath));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.Description, description));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OrgUnitName, orgUnitName));
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.BlockInheritance, blockInheritance.ToString()));
            return(Insert(orgUnitUri, entry));;
        }
コード例 #10
0
        /// <summary>
        /// Updates the given user
        /// </summary>
        /// <param name="domain">The user's domain</param>
        /// <param name="userEmail">The user's email address</param>
        /// <param name="attributes">The set of attributes to update</param>
		/// <returns>The updated user</returns>
        public AppsExtendedEntry UpdateDomainUser(String domain, String userEmail, IDictionary<MultiDomainUserProperty, String> attributes)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String uri = String.Format("{0}/{1}/{2}",
                                       AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain, userEmail);
            entry.EditUri = new Uri(uri);

            foreach (KeyValuePair<MultiDomainUserProperty, String> mapEntry in attributes)
            {
                String value = mapEntry.Value;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                switch (mapEntry.Key)
                {
                    case MultiDomainUserProperty.FirstName:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.FirstName, value));
                        break;
                    case MultiDomainUserProperty.IpWhitelisted:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IpWhitelisted, value));
                        break;
                    case MultiDomainUserProperty.IsAdmin:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsAdmin, value));
                        break;
                    case MultiDomainUserProperty.IsChangePasswordAtNextLogin:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsChangePasswordAtNextLogin, value));
                        break;
                    case MultiDomainUserProperty.IsSuspended:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsSuspended, value));
                        break;
                    case MultiDomainUserProperty.LastName:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.LastName, value));
                        break;
                    case MultiDomainUserProperty.NewEmail:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.NewEmail, value));
                        break;
                    case MultiDomainUserProperty.Password:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.Password, value));
                        break;
                    case MultiDomainUserProperty.UserEmail:
                        entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, value));
                        break;
                    default:
                        break;
                }
            }
            return Update(entry);
        }
コード例 #11
0
		/// <summary>
		/// Creates a new user for the specified domain.
		/// </summary>
        /// <param name="domain">The domain to use to create the user</param>
        /// <param name="userEmail">The user's email address</param>
        /// <param name="password">The user's password</param>
        /// <param name="firstName">The user's first name</param>
		/// <param name="lastName">The user's last name</param>
        /// <param name="isAdmin">Whether the user is an administrator for the domain</param>
        /// <returns>The created user</returns>
        public AppsExtendedEntry CreateDomainUser(String domain, String userEmail, String password,
            String firstName, String lastName, bool isAdmin)
        {
            Uri userUri = new Uri(String.Format("{0}/{1}",
                AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain));

            AppsExtendedEntry entry = new AppsExtendedEntry();
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, userEmail));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.Password, password));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.FirstName, firstName));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.LastName, lastName));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsAdmin, isAdmin.ToString()));
            return Insert(userUri, entry);
        }
コード例 #12
0
        /// <summary>
        /// Creates a new user for the specified domain.
        /// </summary>
        /// <param name="domain">The domain to use to create the user</param>
        /// <param name="userEmail">The user's email address</param>
        /// <param name="password">The user's password</param>
        /// <param name="firstName">The user's first name</param>
        /// <param name="lastName">The user's last name</param>
        /// <param name="isAdmin">Whether the user is an administrator for the domain</param>
        /// <returns>The created user</returns>
        public AppsExtendedEntry CreateDomainUser(String domain, String userEmail, String password,
                                                  String firstName, String lastName, bool isAdmin)
        {
            Uri userUri = new Uri(String.Format("{0}/{1}",
                                                AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain));

            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, userEmail));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.Password, password));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.FirstName, firstName));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.LastName, lastName));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.IsAdmin, isAdmin.ToString()));
            return(Insert(userUri, entry));
        }
コード例 #13
0
        /// <summary>
        /// Updates the orgunit of an organization user.
        /// </summary>
        ///
        /// <param name="customerId"></param>
        /// <param name="orgUserEmail">The email address of the user</param>
        /// <param name="oldOrgUnitPath">The old organization unit path.
        /// If specified, validates the OrgUser's current path.</param>
        /// <param name="newOrgUnitPath"></param>
        /// <returns></returns>
        public AppsExtendedEntry UpdateOrganizationUser(String customerId, String orgUserEmail,
                                                        String newOrgUnitPath, String oldOrgUnitPath)
        {
            String uri = String.Format("{0}/{1}/{2}",
                                       AppsOrganizationNameTable.AppsOrgUserBaseFeedUri, customerId,
                                       orgUserEmail);
            AppsExtendedEntry entry = new AppsExtendedEntry();

            entry.EditUri = new Uri(uri);

            if (!string.IsNullOrEmpty(oldOrgUnitPath))
            {
                entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OldOrgUnitPath, oldOrgUnitPath));
            }
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.NewOrgUnitPath, newOrgUnitPath));
            return(Update(entry));
        }
コード例 #14
0
        /// <summary>
        /// Updates the given organization attributes.
        /// attributes.USERS_TO_MOVE is a comma separated list of email addresses that are to be moved across orgUnits.
        /// </summary>
        /// <param name="customerId">The unique Id of the customer retrieved through customer feed.</param>
        /// <param name="orgUnitPath">The path of the unit to be retrieved for e.g /corp</param>
        /// <param name="attributes">A dictionary of <code>OrgUnitProperty</code> and values to be updated.</param>
        /// <returns></returns>
        public AppsExtendedEntry UpdateOrganizationUnit(String customerId, String orgUnitPath, IDictionary <OrgUnitProperty, String> attributes)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String            uri   = String.Format("{0}/{1}/{2}",
                                                    AppsOrganizationNameTable.AppsOrgUnitBaseFeedUri, customerId,
                                                    orgUnitPath);

            entry.EditUri = new Uri(uri);
            foreach (KeyValuePair <OrgUnitProperty, String> mapEntry in attributes)
            {
                String value = mapEntry.Value;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }
                switch (mapEntry.Key)
                {
                case OrgUnitProperty.Name:
                    entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OrgUnitName, value));
                    break;

                case OrgUnitProperty.ParentOrgUnitPath:
                    entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.ParentOrgUnitPath, value));

                    break;

                case OrgUnitProperty.Description:
                    entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.Description, value));
                    break;

                case OrgUnitProperty.BlockInheritance:
                    entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.BlockInheritance, value));
                    break;

                case OrgUnitProperty.UsersToMove:
                    entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.UsersToMove, value));

                    break;

                default:
                    break;
                }
            }
            return(Update(entry));
        }
コード例 #15
0
 /// <summary>
 /// Creates a new calendar resource. A 
 /// <a href="http://code.google.com/apis/apps/calendar_resource/docs/1.0/calendar_resource_developers_guide_protocol.html#naming_strategy">
 /// good naming strategy</a> is strongly suggested for resources.
 /// 
 /// </summary>
 /// <param name="resourceId">a unique name you give this resource. This is a required 
 /// property. The maximum length is 64 characters.</param>
 /// <param name="commonName">is the resource name seen by users in a calendar's resource
 /// list. This is an optional property when creating a resource, but is strongly 
 /// recommended. This name has a maximum of 100 characters.</param>
 /// <param name="description">a brief summary of this resource shown in the control panel.
 /// This is an optional property, but is strongly recommended. The description is limited 
 /// to a maximum of 1,000 characters.</param>
 /// <param name="type">is a general category common to several resources. This is an 
 /// optional property, but is strongly recommended. The type name has a maximum of 
 /// 100 characters.</param>
 /// <returns>newly created <code>AppsExtendedEntry</code> instance.</returns>
 public AppsExtendedEntry CreateCalendarResource(string resourceId, string commonName,
     string description, string type)
 {
     Uri calendarResourceUri = new Uri(String.Format("{0}/{1}",
         AppsCalendarResourceNameTable.AppsCalendarResourceBaseFeedUri, DomainName));
     AppsExtendedEntry entry = new AppsExtendedEntry();
     entry.Properties.Add(
         new PropertyElement(
         AppsCalendarResourceNameTable.resourceId, resourceId));
     if (!String.IsNullOrEmpty(commonName))
         entry.Properties.Add(
             new PropertyElement(
             AppsCalendarResourceNameTable.resourceCommonName, commonName));
     if (!String.IsNullOrEmpty(description))
         entry.Properties.Add(
             new PropertyElement(
             AppsCalendarResourceNameTable.resourceDescription, description));
     if (!String.IsNullOrEmpty(type))
         entry.Properties.Add(
             new PropertyElement(
             AppsCalendarResourceNameTable.resourceType, type));
     return base.Insert(calendarResourceUri, entry) as AppsExtendedEntry;
 }
コード例 #16
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
            public GDataTypes.GDataGroupEntry CreateGroupEntry(AppsExtendedEntry groupEntry)
            {
                var _gDataGroupEntry = new GDataTypes.GDataGroupEntry();
                _gDataGroupEntry.SelfUri = groupEntry.SelfUri.ToString();
                foreach (var _setting in groupEntry.Properties)
                {
                    if (_setting.Name == "groupId")
                    {
                        _gDataGroupEntry.GroupId = _setting.Value;
                    }
                    else if (_setting.Name == "groupName")
                    {
                        _gDataGroupEntry.GroupName = _setting.Value;
                    }
                    else if (_setting.Name == "description")
                    {
                        _gDataGroupEntry.Description = _setting.Value;
                    }
                    else if (_setting.Name == "emailPermission")
                    {
                        _gDataGroupEntry.EmailPermission = _setting.Value;
                    }

                }
                return _gDataGroupEntry;
            }
コード例 #17
0
        /// <summary>
        /// Creates an alias for an user in the domain
        /// </summary>
		/// <param name="domain">The user's domain</param>
		/// <param name="userEmail">The user's email address</param>
        /// <param name="aliasEmail">The alias to be added to the user</param>
        /// <returns>The created alias</returns>
        public AppsExtendedEntry CreateDomainUserAlias(String domain, String userEmail, String aliasEmail)
        {
            Uri userUri = new Uri(String.Format("{0}/{1}",
                AppsMultiDomainNameTable.AppsMultiDomainAliasBaseFeedUri, domain));

            AppsExtendedEntry entry = new AppsExtendedEntry();
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.UserEmail, userEmail));
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.AliasEmail, aliasEmail));
            return Insert(userUri, entry);
        }
コード例 #18
0
        /// <summary>
        /// Renames an existing user
        /// </summary>
		/// <param name="domain">The user's domain</param>
		/// <param name="userEmail">Current user's email address</param>
		/// <param name="newEmail">New user's email address</param>
        /// <returns>The renamed user</returns>
        public AppsExtendedEntry RenameDomainUser(String domain, String userEmail, String newEmail)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String uri = String.Format("{0}/{1}/{2}",
                                       AppsMultiDomainNameTable.AppsMultiDomainUserBaseFeedUri, domain, userEmail);
            entry.EditUri = new Uri(uri);
            entry.Properties.Add(new PropertyElement(AppsMultiDomainNameTable.NewEmail, newEmail));
            return Update(entry);
        }
コード例 #19
0
 /// <summary>
 /// Creates a new group
 /// </summary>
 /// <param name="groupId">The groupId (required) argument identifies the ID of the new group.</param>
 /// <param name="groupName">The groupName (required) argument identifies the name of the group to 
 /// which the address is being added.</param>
 /// <param name="description">The description argument provides a general description of the group.</param>
 /// <param name="emailPermission">The emailPermission argument sets the permissions level of the group.</param>
 /// <returns>a <code>AppsExtendedEntry</code> containing the results of the
 /// creation</returns>
 public AppsExtendedEntry CreateGroup(String groupId, String groupName, String description, String emailPermission)
 {
     Uri createGroupUri = new Uri(AppsGroupsNameTable.AppsGoogleGroupsBaseFeedUri + "/"
        + domain);
     AppsExtendedEntry entry = new AppsExtendedEntry();
     entry.Properties.Add(
         new PropertyElement(AppsGroupsNameTable.groupId, groupId));
     entry.Properties.Add(
         new PropertyElement(AppsGroupsNameTable.groupName, groupName));
     if (description != null && description != String.Empty)
         entry.Properties.Add(
             new PropertyElement(AppsGroupsNameTable.description, description));
     if (emailPermission != null && emailPermission != String.Empty)
         entry.Properties.Add(
             new PropertyElement(AppsGroupsNameTable.emailPermission, emailPermission));
     return base.Insert(createGroupUri, entry) as AppsExtendedEntry;
 }
コード例 #20
0
        /// <summary>
        /// Updates the orgunit of an organization user.
        /// </summary>
        /// 
        /// <param name="customerId"></param>
        /// <param name="orgUserEmail">The email address of the user</param>
        /// <param name="oldOrgUnitPath">The old organization unit path.
        /// If specified, validates the OrgUser's current path.</param>
        /// <param name="newOrgUnitPath"></param>
        /// <returns></returns>
        public AppsExtendedEntry UpdateOrganizationUser(String customerId, String orgUserEmail,
          String newOrgUnitPath, String oldOrgUnitPath)
        {
            String uri = String.Format("{0}/{1}/{2}",
                                       AppsOrganizationNameTable.AppsOrgUserBaseFeedUri, customerId,
                                       orgUserEmail);
            AppsExtendedEntry entry = new AppsExtendedEntry();
            entry.EditUri = new Uri(uri);

            if (!string.IsNullOrEmpty(oldOrgUnitPath))
            {
                entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OldOrgUnitPath, oldOrgUnitPath));
            }
            entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.NewOrgUnitPath, newOrgUnitPath));
            return Update(entry);
        }
コード例 #21
0
        /// <summary>
        /// Updates the given organization attributes. 
        /// attributes.USERS_TO_MOVE is a comma separated list of email addresses that are to be moved across orgUnits.
        /// </summary>
        /// <param name="customerId">The unique Id of the customer retrieved through customer feed.</param>
        /// <param name="orgUnitPath">The path of the unit to be retrieved for e.g /corp</param>
        /// <param name="attributes">A dictionary of <code>OrgUnitProperty</code> and values to be updated.</param>
        /// <returns></returns>
        public AppsExtendedEntry UpdateOrganizationUnit(String customerId, String orgUnitPath, IDictionary<OrgUnitProperty, String> attributes)
        {
            AppsExtendedEntry entry = new AppsExtendedEntry();
            String uri = String.Format("{0}/{1}/{2}",
                                       AppsOrganizationNameTable.AppsOrgUnitBaseFeedUri, customerId,
                                       HttpUtility.UrlEncode(orgUnitPath));
            entry.EditUri = new AtomUri(uri);
            foreach (KeyValuePair<OrgUnitProperty, String> mapEntry in attributes)
            {
                String value = mapEntry.Value;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }
                switch (mapEntry.Key)
                {
                    case OrgUnitProperty.Name:
                        entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.OrgUnitName, value));
                        break;
                    case OrgUnitProperty.ParentOrgUnitPath:
                        entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.ParentOrgUnitPath, value));

                        break;
                    case OrgUnitProperty.Description:
                        entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.Description, value));
                        break;
                    case OrgUnitProperty.BlockInheritance:
                        entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.BlockInheritance, value));
                        break;
                    case OrgUnitProperty.UsersToMove:
                        entry.Properties.Add(new PropertyElement(AppsOrganizationNameTable.UsersToMove, value));

                        break;
                    default:
                        break;
                }
            }
            return Update(entry);
        }
コード例 #22
0
 /// <summary>
 /// Updates a group
 /// </summary>
 /// <param name="groupId">The groupId (required) argument identifies the ID of the new group.</param>
 /// <param name="groupName">The groupName (required) argument identifies the name of the group to 
 /// which the address is being added.</param>
 /// <param name="description">The description argument provides a general description of the group.</param>
 /// <param name="emailPermission">The emailPermission argument sets the permissions level of the group.</param>
 /// <returns>a <code>AppsExtendedEntry</code> containing the results of the
 /// update</returns>
 public AppsExtendedEntry UpdateGroup(String groupId, String groupName, String description, String emailPermission)
 {
     Uri updateGroupUri = new Uri(AppsGroupsNameTable.AppsGoogleGroupsBaseFeedUri + "/"
        + domain + "/" + groupId);
     AppsExtendedEntry entry = new AppsExtendedEntry();
     entry.EditUri = updateGroupUri;
     entry.Properties.Add(
         new PropertyElement(
         AppsGroupsNameTable.groupId, groupId));
     if (groupName != null && groupName != String.Empty)
         entry.Properties.Add(
             new PropertyElement(
             AppsGroupsNameTable.groupName, groupName));
     if (description != null && description != String.Empty)
         entry.Properties.Add(
             new PropertyElement(
             AppsGroupsNameTable.description, description));
     if (emailPermission != null && emailPermission != String.Empty)
         entry.Properties.Add(
             new PropertyElement(
             AppsGroupsNameTable.emailPermission, emailPermission));
     return base.Update((AtomEntry)entry) as AppsExtendedEntry;
 }
コード例 #23
0
 /// <summary>
 /// Adds an owner to a group
 /// </summary>
 /// <param name="email">owner's Email to add to the group</param>
 /// <param name="groupId">Groups's id</param>
 /// <returns>a <code>AppsExtendedEntry</code> containing the results of the
 /// creation</returns>
 public AppsExtendedEntry AddOwnerToGroup(String email, String groupId)
 {
     Uri addMemberToGroupUri = new Uri(AppsGroupsNameTable.AppsGoogleGroupsBaseFeedUri + "/"
        + domain + "/" + groupId + "/" + ownerUriSuffix);
     AppsExtendedEntry entry = new AppsExtendedEntry();
     entry.Properties.Add(
         new PropertyElement(AppsGroupsNameTable.email, email));
     return base.Insert(addMemberToGroupUri, entry) as AppsExtendedEntry;
 }
コード例 #24
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
 public GDataTypes.GDataGroupOwnerEntry CreateGroupOwnerEntry(AppsExtendedEntry groupOwnerEntry)
 {
     var _gDataGroupOwnerEntry = new GDataTypes.GDataGroupOwnerEntry();
     foreach (var _setting in groupOwnerEntry.Properties)
     {
         if (_setting.Name == "email")
         {
             _gDataGroupOwnerEntry.MemberId = _setting.Value;
         }
         else if (_setting.Name == "type")
         {
             _gDataGroupOwnerEntry.MemberType = _setting.Value;
         }
     }
     return _gDataGroupOwnerEntry;
 }
コード例 #25
0
 public void Init()
 {
     entry = new AppsExtendedEntry();
 }