/// <summary> /// Returns metadata for provided document /// </summary> /// <param name="request">Request. <see cref="GetDocumentMetadataRequest" /></param> /// <returns><see cref="DocumentMetadata"/></returns> public DocumentMetadata GetDocumentMetadata(GetDocumentMetadataRequest request) { // create path and map variables var resourcePath = this.configuration.GetServerUrl() + "/conversion/info"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "filePath", request.FilePath); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.StorageName); var response = this.apiInvoker.InvokeApi( resourcePath, "GET", null, null, null); if (response != null) { return((DocumentMetadata)SerializationHelper.Deserialize(response, typeof(DocumentMetadata))); } return(null); }
public static void Run() { var apiInstance = new InfoApi(Constants.GetConfig()); try { var request = new GetDocumentMetadataRequest("WordProcessing/four-pages.docx", Constants.MyStorage); var response = apiInstance.GetDocumentMetadata(request); Console.WriteLine("InfoResult.Pages.Count: " + response.PageCount); } catch (Exception e) { Console.WriteLine("Exception while calling InfoApi: " + e.Message); } }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new InfoApi(configuration); try { // get document info/metadata request var request = new GetDocumentMetadataRequest { StorageName = Common.MyStorage, FilePath = "conversions/password-protected.docx" }; // Execute api method to get response. var response = apiInstance.GetDocumentMetadata(request); Console.WriteLine("Expected response type is DocumentMetadata: " + response.ToString()); } catch (Exception e) { Console.WriteLine("Exception when calling InfoApi: " + e.Message); } }