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

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        unifiedRoleAssignmentMultipleToInitialize.AppScopes.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (unifiedRoleAssignmentMultipleToInitialize.DirectoryScopes != null && unifiedRoleAssignmentMultipleToInitialize.DirectoryScopes.CurrentPage != null)
                {
                    unifiedRoleAssignmentMultipleToInitialize.DirectoryScopes.AdditionalData = unifiedRoleAssignmentMultipleToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        unifiedRoleAssignmentMultipleToInitialize.DirectoryScopes.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (unifiedRoleAssignmentMultipleToInitialize.Principals != null && unifiedRoleAssignmentMultipleToInitialize.Principals.CurrentPage != null)
                {
                    unifiedRoleAssignmentMultipleToInitialize.Principals.AdditionalData = unifiedRoleAssignmentMultipleToInitialize.AdditionalData;

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

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

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

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