Exemplo n.º 1
0
        /// <summary>
        /// Updates the specified ManagementTemplate using PATCH.
        /// </summary>
        /// <param name="managementTemplateToUpdate">The ManagementTemplate to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="Microsoft.Graph.ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated ManagementTemplate.</returns>
        public async System.Threading.Tasks.Task <ManagementTemplate> UpdateAsync(ManagementTemplate managementTemplateToUpdate, CancellationToken cancellationToken = default)
        {
            this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
            this.Method      = HttpMethods.PATCH;
            var updatedEntity = await this.SendAsync <ManagementTemplate>(managementTemplateToUpdate, cancellationToken).ConfigureAwait(false);

            return(updatedEntity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the specified ManagementTemplate using POST.
        /// </summary>
        /// <param name="managementTemplateToCreate">The ManagementTemplate to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ManagementTemplate.</returns>
        public async System.Threading.Tasks.Task <ManagementTemplate> CreateAsync(ManagementTemplate managementTemplateToCreate, CancellationToken cancellationToken = default)
        {
            this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
            this.Method      = HttpMethods.POST;
            var newEntity = await this.SendAsync <ManagementTemplate>(managementTemplateToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="managementTemplateToInitialize">The <see cref="ManagementTemplate"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ManagementTemplate managementTemplateToInitialize)
 {
     if (managementTemplateToInitialize != null)
     {
         if (managementTemplateToInitialize.ManagementTemplateCollections != null && managementTemplateToInitialize.ManagementTemplateCollections.CurrentPage != null)
         {
             managementTemplateToInitialize.ManagementTemplateCollections.InitializeNextPageRequest(this.Client, managementTemplateToInitialize.ManagementTemplateCollectionsNextLink);
             // Copy the additional data collection to the page itself so that information is not lost
             managementTemplateToInitialize.ManagementTemplateCollections.AdditionalData = managementTemplateToInitialize.AdditionalData;
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates the specified ManagementTemplate using POST and returns a <see cref="GraphResponse{ManagementTemplate}"/> object.
 /// </summary>
 /// <param name="managementTemplateToCreate">The ManagementTemplate to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{ManagementTemplate}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <ManagementTemplate> > CreateResponseAsync(ManagementTemplate managementTemplateToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <ManagementTemplate>(managementTemplateToCreate, cancellationToken));
 }