Hello,
I cannot figure out what is wrong with the following code. Do anyone has idea?
This always returns False.
bool createProj(int projectID, LPCTSTR name, LPCTSTR description){
LONG projectID2 = 0L; LONG lngWorkSpaceID = aaApi_GetWorkspaceProfileId(projectID, 0); LONG userID = aaApi_GetCurrentUserId(); LONG lStorageId = aaApi_GetStorageId(0);
BOOL resultCreate = aaApi_CreateProject(
&projectID2, projectID, lStorageId, userID, AADMS_PROJECT_TYPE_NORMAL,0, lngWorkSpaceID,0,name,description);
return resultCreate;
}
Hongseok, Sorry, thought it was obvious. Use the other error related calls to get the rest of the error information. In ProjectWise, there are three parts to an error, the id, the message and the detail. Look in the help under "Modules" > "ProjectWise API" > "Error Handling Functions" and you will see that you can get the other two parts as well as the id. aaApi_GetLastErrorId() aaApi_GetLastErrorMessage() aaApi_GetLastErrorDetail()
TIP: You can sometimes find specific error codes in the header files. Try greping them. For your error code, 58002, I used Notepad++ to search for the regular expression "\#define.*58002" and found this:
#define AAERR_DMS_ERR_INVALID_ARG 58002
Which tells me that what I suspected, that one of the values you are getting from a static buffer (that you didn't first fill) is probably invalid or perhaps one of the parameters that you are passing to your function (parent id, name or description).
I would check the values you are passing and ensure that none are zero or -1 (other than ProjectId2). aaApi_GetStorageId needs aaApi_SelectStoragesForProject(ProjectId) , executed prior to it to fill the AADMSBUFFER_STORAGE internal buffer.