Skip to content

Instantly share code, notes, and snippets.

@groupdocscloud
Last active April 17, 2020 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groupdocscloud/b613728b13cd4a7c5e1d585361108181 to your computer and use it in GitHub Desktop.
Save groupdocscloud/b613728b13cd4a7c5e1d585361108181 to your computer and use it in GitHub Desktop.
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
AddOptions options = new AddOptions();
ArrayList<AddProperty> properties = new ArrayList<AddProperty>();
AddProperty property = new AddProperty();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
tagOptions.setPossibleName("timeprinted");
searchCriteria.setTagOptions(tagOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
AddRequest request = new AddRequest(options);
AddResult response = apiInstance.add(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
AddOptions options = new AddOptions();
ArrayList<AddProperty> properties = new ArrayList<AddProperty>();
AddProperty property = new AddProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("print");
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
AddRequest request = new AddRequest(options);
AddResult response = apiInstance.add(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
AddOptions options = new AddOptions();
ArrayList<AddProperty> properties = new ArrayList<AddProperty>();
AddProperty property = new AddProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("Lastprinted");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setExactPhrase(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
AddRequest request = new AddRequest(options);
AddResult response = apiInstance.add(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
AddOptions options = new AddOptions();
ArrayList<AddProperty> properties = new ArrayList<AddProperty>();
AddProperty property = new AddProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("^.*print.*");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setIsRegex(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
AddRequest request = new AddRequest(options);
AddResult response = apiInstance.add(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
AddOptions options = new AddOptions();
ArrayList<AddProperty> properties = new ArrayList<AddProperty>();
AddProperty property = new AddProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("^.*print.*");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setIsRegex(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
AddRequest request = new AddRequest(options);
AddResult response = apiInstance.add(request);
package examples.Working_With_Files;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Copy_File {
public static void main(String[] args) {
FileApi apiInstance = new FileApi(Utils.AppSID, Utils.AppKey);
try {
CopyFileRequest request = new CopyFileRequest("WordProcessing\\two-page.docx",
"WordProcessing\\two-page-copied.docx", Utils.MYStorage, Utils.MYStorage, null);
apiInstance.copyFile(request);
System.out.println(
"Expected response type is Void: 'WordProcessing/one-page1.docx' file copied as 'WordProcessing/one-page-copied.docx'.");
} catch (ApiException e) {
System.err.println("Exception while calling FileApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Folder;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Copy_Folder {
public static void main(String[] args) {
FolderApi apiInstance = new FolderApi(Utils.AppSID, Utils.AppKey);
try {
CopyFolderRequest request = new CopyFolderRequest("WordProcessing", "WordProcessing1", Utils.MYStorage,
Utils.MYStorage);
apiInstance.copyFolder(request);
System.out.println("Expected response type is Void: 'WordProcessing' folder copied as 'WordProcessing1'.");
} catch (ApiException e) {
System.err.println("Exception while calling FolderApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Folder;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Create_Folder {
public static void main(String[] args) {
FolderApi apiInstance = new FolderApi(Utils.AppSID, Utils.AppKey);
try {
CreateFolderRequest request = new CreateFolderRequest("WordProcessing", Utils.MYStorage);
apiInstance.createFolder(request);
System.out.println("Expected response type is Void: 'WordProcessing' folder created.");
} catch (ApiException e) {
System.err.println("Exception while calling FolderApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Files;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Delete_File {
public static void main(String[] args) {
FileApi apiInstance = new FileApi(Utils.AppSID, Utils.AppKey);
try {
DeleteFileRequest request = new DeleteFileRequest("WordProcessing\\one-page1.docx", Utils.MYStorage, null);
apiInstance.deleteFile(request);
System.out.println("Expected response type is Void: 'WordProcessing/one-page1.docx' deleted.");
} catch (ApiException e) {
System.err.println("Exception while calling FileApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Folder;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Delete_Folder {
public static void main(String[] args) {
FolderApi apiInstance = new FolderApi(Utils.AppSID, Utils.AppKey);
try {
DeleteFolderRequest request = new DeleteFolderRequest("WordProcessing\\WordProcessing1", Utils.MYStorage, true);
apiInstance.deleteFolder(request);
System.out
.println("Expected response type is Void: 'WordProcessing/WordProcessing1' folder deleted recusrsively.");
} catch (ApiException e) {
System.err.println("Exception while calling FolderApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Files;
import java.io.File;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Download_File {
public static void main(String[] args) {
FileApi apiInstance = new FileApi(Utils.AppSID, Utils.AppKey);
try {
DownloadFileRequest request = new DownloadFileRequest("WordProcessing\\two-page.docx", Utils.MYStorage, null);
File response = apiInstance.downloadFile(request);
System.err.println("Expected response type is File: " + response.length());
} catch (ApiException e) {
System.err.println("Exception while calling FileApi:");
e.printStackTrace();
}
}
}
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
tagOptions.setPossibleName("creator");
searchCriteria.setTagOptions(tagOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("Date");
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("MimeType");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setExactPhrase(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("^dc:.*");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setIsRegex(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
ValueOptions valueOptions = new ValueOptions();
valueOptions.setValue("Microsoft Office Word");
valueOptions.setType("string");
searchCriteria.setValueOptions(valueOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
Tag tag = new Tag();
tag.setName("Created");
tag.setCategory("Time");
tagOptions.setExactTag(tag);
searchCriteria.setTagOptions(tagOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
ExtractOptions options = new ExtractOptions();
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
options.setFileInfo(fileInfo);
ExtractRequest request = new ExtractRequest(options);
ExtractResult response = apiInstance.extract(request);
package examples.Working_With_Storage;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Get_Disc_Usage {
public static void main(String[] args) {
StorageApi apiInstance = new StorageApi(Utils.AppSID, Utils.AppKey);
try {
GetDiscUsageRequest request = new GetDiscUsageRequest(Utils.MYStorage);
DiscUsage response = apiInstance.getDiscUsage(request);
System.out.println("Expected response type is DiscUsage: " + response.getUsedSize());
} catch (ApiException e) {
System.err.println("Exception while calling StorageApi:");
e.printStackTrace();
}
}
}
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
InfoApi apiInstance = new InfoApi(configuration);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
InfoOptions options = new InfoOptions();
options.setFileInfo(fileInfo);
GetInfoRequest request = new GetInfoRequest(options);
InfoResult response = apiInstance.getInfo(request);
package examples.Working_With_Storage;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Get_File_Versions {
public static void main(String[] args) {
StorageApi apiInstance = new StorageApi(Utils.AppSID, Utils.AppKey);
try {
GetFileVersionsRequest request = new GetFileVersionsRequest("Metadata\\one-page.docx", Utils.MYStorage);
FileVersions response = apiInstance.getFileVersions(request);
System.out.println("Expected response type is FileVersions: " + response.getValue().size());
} catch (ApiException e) {
System.err.println("Exception while calling StorageApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Folder;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.FilesList;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Get_Files_List {
public static void main(String[] args) {
FolderApi apiInstance = new FolderApi(Utils.AppSID, Utils.AppKey);
try {
GetFilesListRequest request = new GetFilesListRequest("WordProcessing", Utils.MYStorage);
FilesList response = apiInstance.getFilesList(request);
System.out.println("Expected response type is FilesList.");
for (StorageFile storageFile : response.getValue()) {
System.out.println("Files: " + storageFile.getPath());
}
} catch (ApiException e) {
System.err.println("Exception while calling FolderApi:");
e.printStackTrace();
}
}
}
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
InfoApi apiInstance = new InfoApi(configuration);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
InfoOptions options = new InfoOptions();
options.setFileInfo(fileInfo);
GetInfoRequest request = new GetInfoRequest(options);
InfoResult response = apiInstance.getInfo(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
InfoApi apiInstance = new InfoApi(configuration);
FormatsResult response = apiInstance.getSupportedFileFormats();
package examples.Working_With_Files;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Move_File {
public static void main(String[] args) {
FileApi apiInstance = new FileApi(Utils.AppSID, Utils.AppKey);
try {
MoveFileRequest request = new MoveFileRequest("WordProcessing\\one-page.docx", "WordProcessing\\one-page1.docx",
Utils.MYStorage, Utils.MYStorage, null);
apiInstance.moveFile(request);
System.out.println(
"Expected response type is Void: 'WordProcessing/one-page.docx' file moved to 'WordProcessing1/one-page1.docx'.");
} catch (ApiException e) {
System.err.println("Exception while calling FileApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Folder;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Move_Folder {
public static void main(String[] args) {
FolderApi apiInstance = new FolderApi(Utils.AppSID, Utils.AppKey);
try {
MoveFolderRequest request = new MoveFolderRequest("WordProcessing1", "WordProcessing\\WordProcessing1",
Utils.MYStorage, Utils.MYStorage);WordProcessing
apiInstance.moveFolder(request);
System.out.println(
"Expected response type is Void: 'WordProcessing1' folder moved to 'WordProcessing/WordProcessing1'.");
} catch (ApiException e) {
System.err.println("Exception while calling FolderApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Storage;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Object_Exists {
public static void main(String[] args) {
StorageApi apiInstance = new StorageApi(Utils.AppSID, Utils.AppKey);
try {
ObjectExistsRequest request = new ObjectExistsRequest("Metadata\\one-page.docx", Utils.MYStorage, null);
ObjectExist response = apiInstance.objectExists(request);
System.out.println("Expected response type is ObjectExist: " + response.getExists());
} catch (ApiException e) {
System.err.println("Exception while calling StorageApi:");
e.printStackTrace();
}
}
}
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
tagOptions.setPossibleName("creator");
searchCriteria.setTagOptions(tagOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("Application");
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("NameOfApplication");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setExactPhrase(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("^[N]ame[A-Z].*");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setIsRegex(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
ValueOptions valueOptions = new ValueOptions();
valueOptions.setValue("Microsoft Office Word");
valueOptions.setType("string");
searchCriteria.setValueOptions(valueOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
RemoveOptions options = new RemoveOptions();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
Tag tag = new Tag();
tag.setName("Created");
tag.setCategory("Time");
tagOptions.setExactTag(tag);
searchCriteria.setTagOptions(tagOptions);
options.setSearchCriteria(searchCriteria);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
tagOptions.setPossibleName("creator");
searchCriteria.setTagOptions(tagOptions);
property.setSearchCriteria(searchCriteria);
property.setNewValue("new creator");
property.setType("string");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
Like
Be the first to like this
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("Date");
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
property.setNewValue(dateFormat.format(date));
property.setType("datetime");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
Like
Be the first to like this
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("NameOfApplication");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setExactPhrase(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
property.setNewValue("microsoft word office");
property.setType("string");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.xlsx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
NameOptions nameOptions = new NameOptions();
nameOptions.setValue("^NameOfApp.*");
MatchOptions matchOptions = new MatchOptions();
matchOptions.setIsRegex(true);
nameOptions.setMatchOptions(matchOptions);
searchCriteria.setNameOptions(nameOptions);
property.setSearchCriteria(searchCriteria);
property.setNewValue("new value");
property.setType("string");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
ValueOptions valueOptions = new ValueOptions();
valueOptions.setValue("Microsoft Office Word");
valueOptions.setType("string");
searchCriteria.setValueOptions(valueOptions);
property.setSearchCriteria(searchCriteria);
property.setNewValue("new value");
property.setType("string");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata-cloud/groupdocs-metadata-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
MetadataApi apiInstance = new MetadataApi(configuration);
SetOptions options = new SetOptions();
ArrayList<SetProperty> properties = new ArrayList<SetProperty>();
SetProperty property = new SetProperty();
SearchCriteria searchCriteria = new SearchCriteria();
TagOptions tagOptions = new TagOptions();
Tag tag = new Tag();
tag.setName("Creator");
tag.setCategory("Person");
tagOptions.setExactTag(tag);
searchCriteria.setTagOptions(tagOptions);
property.setSearchCriteria(searchCriteria);
property.setNewValue("NewAuthor");
property.setType("string");
properties.add(property);
options.setProperties(properties);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/input.docx");
options.setFileInfo(fileInfo);
SetRequest request = new SetRequest(options);
SetResult response = apiInstance.set(request);
package examples.Working_With_Storage;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Storage_Exist {
public static void main(String[] args) {
StorageApi apiInstance = new StorageApi(Utils.AppSID, Utils.AppKey);
try {
StorageExistsRequest request = new StorageExistsRequest(Utils.MYStorage);
StorageExist response = apiInstance.storageExists(request);
System.out.println("Expected response type is StorageExist: " + response.getExists());
} catch (ApiException e) {
System.err.println("Exception while calling StorageApi:");
e.printStackTrace();
}
}
}
package examples.Working_With_Files;
import java.io.File;
import java.nio.file.Paths;
import com.groupdocs.cloud.Metadata.api.*;
import com.groupdocs.cloud.Metadata.client.ApiException;
import com.groupdocs.cloud.Metadata.model.*;
import com.groupdocs.cloud.Metadata.model.requests.*;
import examples.Utils;
public class Metadata_Java_Upload_File {
public static void main(String[] args) {
FileApi apiInstance = new FileApi(Utils.AppSID, Utils.AppKey);
try {
File fileStream = new File(
Paths.get("src\\main\\resources").toAbsolutePath().toString() + "\\WordProcessing\\one-page.docx");
UploadFileRequest request = new UploadFileRequest("WordProcessing\\one-page.docx", fileStream,
Utils.MYStorage);
FilesUploadResult response = apiInstance.uploadFile(request);
System.out.println("Expected response type is FilesUploadResult: " + response.getUploaded().size());
} catch (ApiException e) {
System.err.println("Exception while calling FileApi:");
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment