public void TestPostSlidesSetDocumentProperties() { SlidesApi target = new SlidesApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample-input.pptx"; string folder = null; string storage = null; DocumentProperties body = new DocumentProperties(); DocumentProperty docProperty = new DocumentProperty(); docProperty.Name = "Author"; docProperty.Value = "Imran Anwar"; body.List = new System.Collections.Generic.List<DocumentProperty> { docProperty}; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + name)); DocumentPropertiesResponse actual; actual = target.PostSlidesSetDocumentProperties(name, folder, storage, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.Slides.Model.DocumentPropertiesResponse(), actual.GetType()); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="folder"></param> /// <param name="storage"></param> /// <param name="body"></param> /// <returns></returns> public DocumentPropertiesResponse PostSlidesSetDocumentProperties (string name, string folder, string storage, DocumentProperties body) { // create path and map variables var ResourcePath = "/slides/{name}/documentproperties/?appSid={appSid}&folder={folder}&storage={storage}".Replace("{format}","json"); ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}"); // query params var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, object>(); // verify required params are set if (name == null || body == null ) { throw new ApiException(400, "missing required params"); } if (name == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])name=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "name" + "}", apiInvoker.ToPathValue(name)); } if (folder == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder)); } if (storage == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage)); } try { if (typeof(DocumentPropertiesResponse) == typeof(ResponseMessage)) { var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "POST", queryParams, null, headerParams, formParams); return (DocumentPropertiesResponse) ApiInvoker.deserialize(response, typeof(DocumentPropertiesResponse)); } else { var response = apiInvoker.invokeAPI(basePath, ResourcePath, "POST", queryParams, body, headerParams, formParams); if(response != null){ return (DocumentPropertiesResponse) ApiInvoker.deserialize(response, typeof(DocumentPropertiesResponse)); } else { return null; } } } catch (ApiException ex) { if(ex.ErrorCode == 404) { return null; } else { throw ex; } } }