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

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        groupPolicyMigrationReportToInitialize.GroupPolicySettingMappings.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (groupPolicyMigrationReportToInitialize.UnsupportedGroupPolicyExtensions != null && groupPolicyMigrationReportToInitialize.UnsupportedGroupPolicyExtensions.CurrentPage != null)
                {
                    groupPolicyMigrationReportToInitialize.UnsupportedGroupPolicyExtensions.AdditionalData = groupPolicyMigrationReportToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        groupPolicyMigrationReportToInitialize.UnsupportedGroupPolicyExtensions.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
        /// <summary>
        /// Creates the specified GroupPolicyMigrationReport using POST.
        /// </summary>
        /// <param name="groupPolicyMigrationReportToCreate">The GroupPolicyMigrationReport to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created GroupPolicyMigrationReport.</returns>
        public async System.Threading.Tasks.Task <GroupPolicyMigrationReport> CreateAsync(GroupPolicyMigrationReport groupPolicyMigrationReportToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <GroupPolicyMigrationReport>(groupPolicyMigrationReportToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Exemple #5
0
 /// <summary>
 /// Adds the specified GroupPolicyMigrationReport to the collection via POST.
 /// </summary>
 /// <param name="groupPolicyMigrationReport">The GroupPolicyMigrationReport to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created GroupPolicyMigrationReport.</returns>
 public System.Threading.Tasks.Task <GroupPolicyMigrationReport> AddAsync(GroupPolicyMigrationReport groupPolicyMigrationReport, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <GroupPolicyMigrationReport>(groupPolicyMigrationReport, cancellationToken));
 }
Exemple #6
0
 /// <summary>
 /// Adds the specified GroupPolicyMigrationReport to the collection via POST.
 /// </summary>
 /// <param name="groupPolicyMigrationReport">The GroupPolicyMigrationReport to add.</param>
 /// <returns>The created GroupPolicyMigrationReport.</returns>
 public System.Threading.Tasks.Task <GroupPolicyMigrationReport> AddAsync(GroupPolicyMigrationReport groupPolicyMigrationReport)
 {
     return(this.AddAsync(groupPolicyMigrationReport, CancellationToken.None));
 }