コード例 #1
0
        /// <summary>
        /// Updates the specified TeamworkHostedContent using PATCH.
        /// </summary>
        /// <param name="teamworkHostedContentToUpdate">The TeamworkHostedContent 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 TeamworkHostedContent.</returns>
        public async System.Threading.Tasks.Task <TeamworkHostedContent> UpdateAsync(TeamworkHostedContent teamworkHostedContentToUpdate, CancellationToken cancellationToken)
        {
            if (teamworkHostedContentToUpdate.AdditionalData != null)
            {
                if (teamworkHostedContentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    teamworkHostedContentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamworkHostedContentToUpdate.GetType().Name)
                    });
                }
            }
            if (teamworkHostedContentToUpdate.AdditionalData != null)
            {
                if (teamworkHostedContentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    teamworkHostedContentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamworkHostedContentToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <TeamworkHostedContent>(teamworkHostedContentToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
コード例 #3
0
 /// <summary>
 /// Creates the specified TeamworkHostedContent using POST.
 /// </summary>
 /// <param name="teamworkHostedContentToCreate">The TeamworkHostedContent to create.</param>
 /// <returns>The created TeamworkHostedContent.</returns>
 public System.Threading.Tasks.Task <TeamworkHostedContent> CreateAsync(TeamworkHostedContent teamworkHostedContentToCreate)
 {
     return(this.CreateAsync(teamworkHostedContentToCreate, CancellationToken.None));
 }
コード例 #4
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="teamworkHostedContentToInitialize">The <see cref="TeamworkHostedContent"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TeamworkHostedContent teamworkHostedContentToInitialize)
 {
 }