Пример #1
0
 /// <summary>
 /// Adds the specified WindowsPrivacyDataAccessControlItem to the collection via POST.
 /// </summary>
 /// <param name="windowsPrivacyDataAccessControlItem">The WindowsPrivacyDataAccessControlItem to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created WindowsPrivacyDataAccessControlItem.</returns>
 public System.Threading.Tasks.Task <WindowsPrivacyDataAccessControlItem> AddAsync(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItem, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <WindowsPrivacyDataAccessControlItem>(windowsPrivacyDataAccessControlItem, cancellationToken));
 }
Пример #2
0
 /// <summary>
 /// Adds the specified WindowsPrivacyDataAccessControlItem to the collection via POST.
 /// </summary>
 /// <param name="windowsPrivacyDataAccessControlItem">The WindowsPrivacyDataAccessControlItem to add.</param>
 /// <returns>The created WindowsPrivacyDataAccessControlItem.</returns>
 public System.Threading.Tasks.Task <WindowsPrivacyDataAccessControlItem> AddAsync(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItem)
 {
     return(this.AddAsync(windowsPrivacyDataAccessControlItem, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified WindowsPrivacyDataAccessControlItem using POST.
        /// </summary>
        /// <param name="windowsPrivacyDataAccessControlItemToCreate">The WindowsPrivacyDataAccessControlItem to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created WindowsPrivacyDataAccessControlItem.</returns>
        public async System.Threading.Tasks.Task <WindowsPrivacyDataAccessControlItem> CreateAsync(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItemToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <WindowsPrivacyDataAccessControlItem>(windowsPrivacyDataAccessControlItemToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="windowsPrivacyDataAccessControlItemToInitialize">The <see cref="WindowsPrivacyDataAccessControlItem"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItemToInitialize)
 {
 }
        /// <summary>
        /// Updates the specified WindowsPrivacyDataAccessControlItem using PATCH.
        /// </summary>
        /// <param name="windowsPrivacyDataAccessControlItemToUpdate">The WindowsPrivacyDataAccessControlItem 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 WindowsPrivacyDataAccessControlItem.</returns>
        public async System.Threading.Tasks.Task <WindowsPrivacyDataAccessControlItem> UpdateAsync(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItemToUpdate, CancellationToken cancellationToken)
        {
            if (windowsPrivacyDataAccessControlItemToUpdate.AdditionalData != null)
            {
                if (windowsPrivacyDataAccessControlItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    windowsPrivacyDataAccessControlItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsPrivacyDataAccessControlItemToUpdate.GetType().Name)
                    });
                }
            }
            if (windowsPrivacyDataAccessControlItemToUpdate.AdditionalData != null)
            {
                if (windowsPrivacyDataAccessControlItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    windowsPrivacyDataAccessControlItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsPrivacyDataAccessControlItemToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <WindowsPrivacyDataAccessControlItem>(windowsPrivacyDataAccessControlItemToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Updates the specified WindowsPrivacyDataAccessControlItem using PATCH.
 /// </summary>
 /// <param name="windowsPrivacyDataAccessControlItemToUpdate">The WindowsPrivacyDataAccessControlItem to update.</param>
 /// <returns>The updated WindowsPrivacyDataAccessControlItem.</returns>
 public System.Threading.Tasks.Task <WindowsPrivacyDataAccessControlItem> UpdateAsync(WindowsPrivacyDataAccessControlItem windowsPrivacyDataAccessControlItemToUpdate)
 {
     return(this.UpdateAsync(windowsPrivacyDataAccessControlItemToUpdate, CancellationToken.None));
 }