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

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

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