I’m trying to obtain the WBS numbers but not getting any information. The response is currently returning null. I’m using the sample project file from this repo. What are the proper steps for getting WBS information?
Thank you
mport { TasksApi } from "@asposecloud/aspose-tasks-cloud";
import { UploadFileRequest, GetTaskLinksRequest, GetOutlineCodesRequest, GetWbsDefinitionRequest } from "@asposecloud/aspose-tasks-cloud";
import fs from 'fs';
// Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
const tasksApi = new TasksApi("", "");
const fileName = "SummaryTaskWithSubtasks.mpp";
const localPath = "./" + fileName;
const remotePath = "/data";
const remoteFullPath = remotePath + "/" + fileName;
const uploadedFiles = new Set();
const request = new UploadFileRequest();
request.path = remoteFullPath;
request.file = fs.readFileSync(localPath);
uploadedFiles.add(remoteFullPath);
await tasksApi.uploadFile(request);
const getWbsDefinitionRequest = new GetWbsDefinitionRequest();
getWbsDefinitionRequest.name = fileName;
getWbsDefinitionRequest.folder = remotePath;
const result = await tasksApi.getWbsDefinition(getWbsDefinitionRequest);
@sebworks
To obtain WBS (Work Breakdown Structure) numbers using the Aspose.Tasks Cloud API, you need to ensure that you are correctly setting up your requests and handling the responses. Here are the steps you should follow:
-
Upload the Project File: Make sure that the project file (e.g., SummaryTaskWithSubtasks.mpp
) is successfully uploaded to the cloud storage. You can verify this by checking the response from the upload request.
-
Create the GetWbsDefinitionRequest: You have already created the request to get the WBS definition. Ensure that you are specifying the correct file name and folder path in your request.
-
Execute the Request: After setting up the GetWbsDefinitionRequest
, you need to call the appropriate method from the TasksApi
to execute this request and retrieve the WBS information.
Here is an example of how you might implement this:
const getWbsDefinitionResponse = await tasksApi.getWbsDefinition(getWbsDefinitionRequest);
if (getWbsDefinitionResponse && getWbsDefinitionResponse.wbs) {
console.log("WBS Information:", getWbsDefinitionResponse.wbs);
} else {
console.log("No WBS information found.");
}
-
Check for Null Responses: If you are receiving a null response, ensure that:
- The project file contains tasks with WBS codes.
- The file is correctly uploaded and accessible.
- You are using the correct API endpoint and method for retrieving WBS information.
-
Debugging: If the issue persists, consider checking the logs or responses from the API for any error messages that might indicate what went wrong.
By following these steps, you should be able to retrieve the WBS numbers from your project file. If you continue to experience issues, please provide additional details about the responses you are receiving, and I can assist further.
Sources:
[1]: WbsAssociatedWithTask.java
@ Professionalize.Discourse
I’m getting the following response: { code: 200, status: ‘OK’, wbsDefinition: null }. I’ve tried three different MS Project files and it always returns null.
@sebworks ,
this API returns project’s WBS code definition (if it is present in the project):
Screenshot_1.png
Have you tried MS Project file where WBS code definition is present?
For example, ‘WBSDefinition.mpp’ ?
@sebworks ,
WBS Code Definition is not present in the attached project:
Thus GET WbsCodeDefinition endpoint returns null.
@vasiliy.sinitsyn, Thank you. I didnt realize it wasn’t generating WBS numbers. Perhaps i’m thinking about outline numbers. Does the cloud offering provide a way to obtain those?
@sebworks ,
in fact WBS Code definition defines the way task’s WBS numbers are generated. If it is empty, the default MS Project’s scheme is used:
1
1.1
1.1.1
1.1.2
1.2
1.2.1
2
2.1
2.1.1
The following figure shows the WBS, Outline Level and Outline Number columns for your project:
.
If you change the project’s WBS Code Definition, values in the WBS column will be regenerated according to the Code Definition, but values in the ‘Outline Number’ column will not change.
You can access WBS property on per-task basis using GetTask endpoint.
The issue is that you have to create many requests to access the wbs info. Is there any other method for obtaining this information in one request?
@sebworks ,
there is no API to retrieve all tasks in one request which include this information.
Would it be possible to make a change request to include this information?
@sebworks ,
looks like we need more information about the use case.
What API endpoint do you use to retrieve tasks information?
I am working on a site that needs to import and export wbs charts. I am calling the GetTasksRequest endpoint.
@sebworks ,
The proposal was discussed with the product team. The desribed change request cannot be done.