PW sdk, How to find projectid for function aaApi_SelectProject() ?

Hi,

How to find projectid for function PWWrapper.aaApi_SelectProject(3790);  ?

Thanks'

Parents
  • Ron, there are several ways to find or discover a project's ID. You can ask the user to choose it from a ProjectWise dialog with a call to aaApi_SelectProjectDlg (...). You can also crawl the tree starting with int count = PWWrapper.aaApi_SelectTopLevelProjects (). Note that this buffer will be overwritten by any call of aaApi_SelectProject(...). Then use a For loop to loop (0 to count-1) through that buffered list using int ProjId = aaApi_GetProjectNumericProperty (index) (you can not use a foreach). That will give you the ProjectID for each top level folder.

    Then for each top level folder you can call
    int SubFolderCount = aaApi_SelectProjectsFromBranch (ProjectId, null, null,null) --- This call returns every subfolder of the ProjectID into the buffer. If you use null for ProjectID, it returns every folder in the datasource into the buffer.

    Or, you can recursively call
    IntPtr pSubFolder = aaApi_SelectProjectDataBufferChilds(ProjectID), which puts only the direct subfolders into the pSubFolder buffer. You will need to use the aaApi_DmsDataBufferGetNumericProperty (...) function to get the ProjectID from each child which can be passed to the function again to get the next set of children.

    So there is not a direct approach. It all depends on what you are needing to accomplish as to how you get the ProjectID

    Answer Verified By: Afa Lin 

Reply
  • Ron, there are several ways to find or discover a project's ID. You can ask the user to choose it from a ProjectWise dialog with a call to aaApi_SelectProjectDlg (...). You can also crawl the tree starting with int count = PWWrapper.aaApi_SelectTopLevelProjects (). Note that this buffer will be overwritten by any call of aaApi_SelectProject(...). Then use a For loop to loop (0 to count-1) through that buffered list using int ProjId = aaApi_GetProjectNumericProperty (index) (you can not use a foreach). That will give you the ProjectID for each top level folder.

    Then for each top level folder you can call
    int SubFolderCount = aaApi_SelectProjectsFromBranch (ProjectId, null, null,null) --- This call returns every subfolder of the ProjectID into the buffer. If you use null for ProjectID, it returns every folder in the datasource into the buffer.

    Or, you can recursively call
    IntPtr pSubFolder = aaApi_SelectProjectDataBufferChilds(ProjectID), which puts only the direct subfolders into the pSubFolder buffer. You will need to use the aaApi_DmsDataBufferGetNumericProperty (...) function to get the ProjectID from each child which can be passed to the function again to get the next set of children.

    So there is not a direct approach. It all depends on what you are needing to accomplish as to how you get the ProjectID

    Answer Verified By: Afa Lin 

Children
No Data