Hello All,
I have to build a connector in c# to fetch all the documents present in ProjectWise in my c# code .
Please can anyone help with it urgently
Niharika,
"Words get in the way" again. "Fetch" in the ProjectWise SDK has the connotation of "getting" the document (and file) from the storage area to somewhere else, i.e. Check-Out, Copy-Out, Export, etc.
Assuming that you want to get a "list" of all the documents in a datasource, might want to look into using aaApi_SelectDocuments2() as the documentation seems to indicate that if you pass a 0 as the first parameter, it will search each "project", which in this context I interpret as each folder in the datasource.
I created a quick test program with C++, and this returned the correct count:
You also need to understand that "all documents" includes all versions, as well as flat sets, so you will need to deal with that as well.
To do this in C#, you will have to deal with managed and unmanaged code as I don't see this specific ProjectWise API function exposed in MostOfDavesClasses.
An alternate approach would be to use aaApi_SelectTopLevelProjects(), and then iterate through each top level project, select all the documents in that folder and below with a call to aaApi_SelectDocumentsByProjectId().
Another way might be to create a saved search to select just the documents that you want to count, and then use that saved search to select them. If you take a look at MostOfDavesClasses, you will see PWSearch.SearchForDocumentsByQueryName(), which will return a DataTable with the documents returned by the saved search.
You can find MostOfDavesClasses here: https://github.com/DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise
And you can find a sample project on how to create saved search using C# here: https://communities.bentley.com/products/programming/projectwise_programming/f/projectwise-programming---forum/191316/sample-in-c-for-creating-saved-searches