Exemplo n.º 1
0
        /// <summary>
        /// Updates the specified SiteSource using PATCH.
        /// </summary>
        /// <param name="siteSourceToUpdate">The SiteSource to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="Microsoft.Graph.ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated SiteSource.</returns>
        public async System.Threading.Tasks.Task <SiteSource> UpdateAsync(SiteSource siteSourceToUpdate, CancellationToken cancellationToken)
        {
            if (siteSourceToUpdate.AdditionalData != null)
            {
                if (siteSourceToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) ||
                    siteSourceToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode))
                {
                    throw new Microsoft.Graph.ClientException(
                              new Microsoft.Graph.Error
                    {
                        Code    = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, siteSourceToUpdate.GetType().Name)
                    });
                }
            }
            if (siteSourceToUpdate.AdditionalData != null)
            {
                if (siteSourceToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) ||
                    siteSourceToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode))
                {
                    throw new Microsoft.Graph.ClientException(
                              new Microsoft.Graph.Error
                    {
                        Code    = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, siteSourceToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <SiteSource>(siteSourceToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates the specified SiteSource using POST.
 /// </summary>
 /// <param name="siteSourceToCreate">The SiteSource to create.</param>
 /// <returns>The created SiteSource.</returns>
 public System.Threading.Tasks.Task <SiteSource> CreateAsync(SiteSource siteSourceToCreate)
 {
     return(this.CreateAsync(siteSourceToCreate, CancellationToken.None));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="siteSourceToInitialize">The <see cref="SiteSource"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SiteSource siteSourceToInitialize)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the specified SiteSource to the collection via POST.
 /// </summary>
 /// <param name="siteSource">The SiteSource to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SiteSource.</returns>
 public System.Threading.Tasks.Task <SiteSource> AddAsync(SiteSource siteSource, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SiteSource>(siteSource, cancellationToken));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds the specified SiteSource to the collection via POST.
 /// </summary>
 /// <param name="siteSource">The SiteSource to add.</param>
 /// <returns>The created SiteSource.</returns>
 public System.Threading.Tasks.Task <SiteSource> AddAsync(SiteSource siteSource)
 {
     return(this.AddAsync(siteSource, CancellationToken.None));
 }