/// <summary> /// Adds the specified MobileContainedApp to the collection via POST. /// </summary> /// <param name="mobileContainedApp">The MobileContainedApp to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created MobileContainedApp.</returns> public System.Threading.Tasks.Task <MobileContainedApp> AddAsync(MobileContainedApp mobileContainedApp, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; mobileContainedApp.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(mobileContainedApp.GetType().FullName)); return(this.SendAsync <MobileContainedApp>(mobileContainedApp, cancellationToken)); }
/// <summary> /// Updates the specified MobileContainedApp using PATCH. /// </summary> /// <param name="mobileContainedAppToUpdate">The MobileContainedApp 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 MobileContainedApp.</returns> public async System.Threading.Tasks.Task <MobileContainedApp> UpdateAsync(MobileContainedApp mobileContainedAppToUpdate, CancellationToken cancellationToken) { if (mobileContainedAppToUpdate.AdditionalData != null) { if (mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileContainedAppToUpdate.GetType().Name) }); } } if (mobileContainedAppToUpdate.AdditionalData != null) { if (mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileContainedAppToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <MobileContainedApp>(mobileContainedAppToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }