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

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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="plannerGroupToInitialize">The <see cref="PlannerGroup"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(PlannerGroup plannerGroupToInitialize)
        {
            if (plannerGroupToInitialize != null && plannerGroupToInitialize.AdditionalData != null)
            {
                if (plannerGroupToInitialize.Plans != null && plannerGroupToInitialize.Plans.CurrentPage != null)
                {
                    plannerGroupToInitialize.Plans.AdditionalData = plannerGroupToInitialize.AdditionalData;

                    object nextPageLink;
                    plannerGroupToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        plannerGroupToInitialize.Plans.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates the specified PlannerGroup using POST.
 /// </summary>
 /// <param name="plannerGroupToCreate">The PlannerGroup to create.</param>
 /// <returns>The created PlannerGroup.</returns>
 public System.Threading.Tasks.Task <PlannerGroup> CreateAsync(PlannerGroup plannerGroupToCreate)
 {
     return(this.CreateAsync(plannerGroupToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified PlannerGroup using POST and returns a <see cref="GraphResponse{PlannerGroup}"/> object.
 /// </summary>
 /// <param name="plannerGroupToCreate">The PlannerGroup to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{PlannerGroup}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <PlannerGroup> > CreateResponseAsync(PlannerGroup plannerGroupToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <PlannerGroup>(plannerGroupToCreate, cancellationToken));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="plannerGroupToInitialize">The <see cref="PlannerGroup"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(PlannerGroup plannerGroupToInitialize)
 {
 }