示例#1
0
        /// <summary>
        /// Updates the specified ExternalGroupMember using PATCH.
        /// </summary>
        /// <param name="externalGroupMemberToUpdate">The ExternalGroupMember to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated ExternalGroupMember.</returns>
        public async System.Threading.Tasks.Task <ExternalGroupMember> UpdateAsync(ExternalGroupMember externalGroupMemberToUpdate, CancellationToken cancellationToken)
        {
            if (externalGroupMemberToUpdate.AdditionalData != null)
            {
                if (externalGroupMemberToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    externalGroupMemberToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, externalGroupMemberToUpdate.GetType().Name)
                    });
                }
            }
            if (externalGroupMemberToUpdate.AdditionalData != null)
            {
                if (externalGroupMemberToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    externalGroupMemberToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, externalGroupMemberToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ExternalGroupMember>(externalGroupMemberToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
示例#2
0
        /// <summary>
        /// Creates the specified ExternalGroupMember using POST.
        /// </summary>
        /// <param name="externalGroupMemberToCreate">The ExternalGroupMember to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ExternalGroupMember.</returns>
        public async System.Threading.Tasks.Task <ExternalGroupMember> CreateAsync(ExternalGroupMember externalGroupMemberToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ExternalGroupMember>(externalGroupMemberToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#3
0
 /// <summary>
 /// Creates the specified ExternalGroupMember using POST.
 /// </summary>
 /// <param name="externalGroupMemberToCreate">The ExternalGroupMember to create.</param>
 /// <returns>The created ExternalGroupMember.</returns>
 public System.Threading.Tasks.Task <ExternalGroupMember> CreateAsync(ExternalGroupMember externalGroupMemberToCreate)
 {
     return(this.CreateAsync(externalGroupMemberToCreate, CancellationToken.None));
 }
示例#4
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="externalGroupMemberToInitialize">The <see cref="ExternalGroupMember"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ExternalGroupMember externalGroupMemberToInitialize)
 {
 }
示例#5
0
 /// <summary>
 /// Adds the specified ExternalGroupMember to the collection via POST.
 /// </summary>
 /// <param name="externalGroupMember">The ExternalGroupMember to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ExternalGroupMember.</returns>
 public System.Threading.Tasks.Task <ExternalGroupMember> AddAsync(ExternalGroupMember externalGroupMember, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ExternalGroupMember>(externalGroupMember, cancellationToken));
 }
示例#6
0
 /// <summary>
 /// Adds the specified ExternalGroupMember to the collection via POST.
 /// </summary>
 /// <param name="externalGroupMember">The ExternalGroupMember to add.</param>
 /// <returns>The created ExternalGroupMember.</returns>
 public System.Threading.Tasks.Task <ExternalGroupMember> AddAsync(ExternalGroupMember externalGroupMember)
 {
     return(this.AddAsync(externalGroupMember, CancellationToken.None));
 }