예제 #1
0
 public async Task <ISyntexModelPublicationResult> UnPublishModelAsync(SyntexModelUnPublishOptions unPublicationOptions)
 {
     return(ProcessModelPublishResponse(await UnPublishModelApiRequestAsync(UniqueId,
                                                                            unPublicationOptions.TargetSiteUrl,
                                                                            unPublicationOptions.TargetWebServerRelativeUrl,
                                                                            unPublicationOptions.TargetLibraryServerRelativeUrl).ConfigureAwait(false)));
 }
예제 #2
0
 public IBatchSingleResult <ISyntexModelPublicationResult> UnPublishModelBatch(SyntexModelUnPublishOptions unPublicationOptions)
 {
     return(UnPublishModelBatchAsync(unPublicationOptions).GetAwaiter().GetResult());
 }
예제 #3
0
 public async Task <IBatchSingleResult <ISyntexModelPublicationResult> > UnPublishModelBatchAsync(SyntexModelUnPublishOptions unPublicationOptions)
 {
     return(await UnPublishModelBatchAsync((ListItem as ListItem).PnPContext.CurrentBatch, unPublicationOptions).ConfigureAwait(false));
 }
예제 #4
0
        public async Task <IBatchSingleResult <ISyntexModelPublicationResult> > UnPublishModelBatchAsync(Batch batch, SyntexModelUnPublishOptions unPublicationOptions)
        {
            System.Dynamic.ExpandoObject unPublishInfo = UnPublishModelApiRequestBody(UniqueId, unPublicationOptions.TargetSiteUrl,
                                                                                      unPublicationOptions.TargetWebServerRelativeUrl,
                                                                                      unPublicationOptions.TargetLibraryServerRelativeUrl);

            string body = JsonSerializer.Serialize(unPublishInfo, PnPConstants.JsonSerializer_IgnoreNullValues_StringEnumConvertor);

            var apiCall = new ApiCall("_api/machinelearning/publications/batchdelete", ApiType.SPORest, body)
            {
                RawSingleResult   = new SyntexModelPublicationResult(),
                RawResultsHandler = (json, apiCall) =>
                {
                    List <SyntexModelPublicationResult> modelPublicationResults = ParseModelPublishResponse(json);
                    var firstModelPublicationResult = modelPublicationResults.First();
                    (apiCall.RawSingleResult as SyntexModelPublicationResult).ErrorMessage = firstModelPublicationResult.ErrorMessage;
                    (apiCall.RawSingleResult as SyntexModelPublicationResult).Publication  = firstModelPublicationResult.Publication;
                    (apiCall.RawSingleResult as SyntexModelPublicationResult).StatusCode   = firstModelPublicationResult.StatusCode;
                }
            };

            var batchRequest = await(ListItem as ListItem).RawRequestBatchAsync(batch, apiCall, HttpMethod.Post).ConfigureAwait(false);

            return(new BatchSingleResult <ISyntexModelPublicationResult>(batch, batchRequest.Id, apiCall.RawSingleResult as ISyntexModelPublicationResult));
        }
예제 #5
0
 public ISyntexModelPublicationResult UnPublishModel(SyntexModelUnPublishOptions unPublicationOptions)
 {
     return(UnPublishModelAsync(unPublicationOptions).GetAwaiter().GetResult());
 }