Exemple #1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="educationSynchronizationProfileToInitialize">The <see cref="EducationSynchronizationProfile"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(EducationSynchronizationProfile educationSynchronizationProfileToInitialize)
        {
            if (educationSynchronizationProfileToInitialize != null && educationSynchronizationProfileToInitialize.AdditionalData != null)
            {
                if (educationSynchronizationProfileToInitialize.Errors != null && educationSynchronizationProfileToInitialize.Errors.CurrentPage != null)
                {
                    educationSynchronizationProfileToInitialize.Errors.AdditionalData = educationSynchronizationProfileToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        educationSynchronizationProfileToInitialize.Errors.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
 /// <summary>
 /// Adds the specified EducationSynchronizationProfile to the collection via POST.
 /// </summary>
 /// <param name="educationSynchronizationProfile">The EducationSynchronizationProfile to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created EducationSynchronizationProfile.</returns>
 public System.Threading.Tasks.Task <EducationSynchronizationProfile> AddAsync(EducationSynchronizationProfile educationSynchronizationProfile, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <EducationSynchronizationProfile>(educationSynchronizationProfile, cancellationToken));
 }
 /// <summary>
 /// Adds the specified EducationSynchronizationProfile to the collection via POST.
 /// </summary>
 /// <param name="educationSynchronizationProfile">The EducationSynchronizationProfile to add.</param>
 /// <returns>The created EducationSynchronizationProfile.</returns>
 public System.Threading.Tasks.Task <EducationSynchronizationProfile> AddAsync(EducationSynchronizationProfile educationSynchronizationProfile)
 {
     return(this.AddAsync(educationSynchronizationProfile, CancellationToken.None));
 }
Exemple #4
0
        /// <summary>
        /// Creates the specified EducationSynchronizationProfile using POST.
        /// </summary>
        /// <param name="educationSynchronizationProfileToCreate">The EducationSynchronizationProfile to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created EducationSynchronizationProfile.</returns>
        public async System.Threading.Tasks.Task <EducationSynchronizationProfile> CreateAsync(EducationSynchronizationProfile educationSynchronizationProfileToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <EducationSynchronizationProfile>(educationSynchronizationProfileToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }