Get Document Properties of a Project Introduction
This example explains how to get a collection of a project’s document properties, using Aspose.Tasks Cloud. Aspose.Tasks Cloud is a REST API which can be used with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.
API
Type
Description
Resource Link
/tasks/{name}/documentproperties
GET
Read collection of document properties from a MS Project File
GetDocumentProperties
cURL Example
Request
Copy
curl - X GET "https://api.aspose.cloud/v3.0/tasks/Home%20move%20plan.mpp/documentproperties" - H "accept: application/json" - H "x-aspose-client: Containerize.Swagger"
Response
Copy
{
"code" : 0 ,
"status" : "string" ,
"properties" : {
"link" : {
"href" : "string" ,
"rel" : "string" ,
"type" : "string" ,
"title" : "string"
},
"list" : [
{
"link" : {
"href" : "string" ,
"rel" : "string" ,
"type" : "string" ,
"title" : "string"
},
"name" : "string" ,
"value" : "string"
}
]
}
}
SDKs
The Aspose.Tasks Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet/
var remoteName = await UploadFileToStorageAsync("Home move plan.mpp");
var response = await TasksApi.GetDocumentPropertiesAsync(new GetDocumentPropertiesRequest
{
Name = remoteName,
Folder = this.DataFolder
});
Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(52, response.Properties.List.Count);
Assert.AreEqual("Title", response.Properties.List[0].Name);
Assert.AreEqual("Home Move", response.Properties.List[0].Value);
PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-php/
$remoteName = "GetDocumentProperties.mpp";
$folder = $this->uploadFile("Home move plan.mpp", $remoteName, '');
$response = $this->tasks->getDocumentProperties(new Requests\GetDocumentPropertiesRequest($remoteName, self::$storageName, $folder));
Assert::assertEquals(200, $response->getCode());
Assert::assertEquals(52, count($response->getProperties()->getList()));
Assert::assertEquals("Title", $response->getProperties()->getList()[0]->getName());
Assert::assertEquals("Home Move", $response->getProperties()->getList()[0]->getValue());
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-python
filename = 'Home_move_plan.mpp'
self.upload_file(filename)
request = GetDocumentPropertiesRequest(filename)
result = self.tasks_api.get_document_properties(request)
self.assertIsNotNone(result)
self.assertIsInstance(result, DocumentPropertiesResponse)
self.assertIsNotNone(result.properties)
self.assertEqual(51, len(result.properties.list))
self.assertEqual('Title', result.properties.list[0].name)
self.assertEqual('Home Move', result.properties.list[0].value)
Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-node
const fileName = "Home_move_plan.mpp";
const localPath = "./Data/" + fileName;
const remotePath = "Temp/Data";
const remoteFullPath = remotePath + "/" + fileName;
await tasksApi.uploadFileToStorage(remoteFullPath, localPath);
const request = new GetDocumentPropertiesRequest();
request.name = fileName;
request.folder = remotePath;
const result = await tasksApi.getDocumentProperties(request);
expect(result.response.statusCode).to.equal(200);
expect(result.body.properties.list.length).to.equal(52);
expect(result.body.properties.list[0].name).to.equal("Title");
expect(result.body.properties.list[0].value).to.equal("Home Move");
Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-go/
client, ctx := UploadTestFileToStorage(t, localFileName, remoteBaseTestDataFolder+"/"+remoteFileName)
options := &requests.GetDocumentPropertiesOpts{
Name: remoteFileName,
Folder: optional.NewString(remoteBaseTestDataFolder),
}
result, _, err := client.TasksApi.GetDocumentProperties(ctx, options)
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), result.Code)
assert.NotNil(t, result.Properties)
assert.Equal(t, 52, len(result.Properties.List))
assert.Equal(t, "Title", result.Properties.List[0].Name)
assert.Equal(t, "Home Move", result.Properties.List[0].Value)
Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java/
String localFileName = "Home_move_plan.mpp";
String remoteFileName = TestInitializer.UploadFile(localFileName);
GetDocumentPropertiesRequest request = new GetDocumentPropertiesRequest(remoteFileName, null, null);
DocumentPropertiesResponse result = TestInitializer.tasksApi.getDocumentProperties(request);
assertNotNull(result);
assertEquals(200, (int) result.getCode());
assertNotNull(result.getProperties());
assertEquals(52, result.getProperties().getList().size());
assertEquals("Title", result.getProperties().getList().get(0).getName());
assertEquals("Home Move", result.getProperties().getList().get(0).getValue());