I'am using the SDK kit to create folders and documents, which works fine, even in VB.NET. But i'am not having any luck in setting the environment name.
Normaly when you create a folder it inherit the environment settings from the parent folder, but it doesn't seem to be the issue when i'am creating folders with the SDK kit.
Is there a way to assign an environemt to a folder an a document. The other solution would be creating the information in the SQL database manually doesn't sound appealing :-)
Thank a'lot in advance
You can do it with aaApi_CreateProject2(). You can also do it after you create it with one of the "project" modify functions. Keep in mind that in the ProjectWise SDK documentation, for legacy reasons, that "folders" are referred to as "projects" and "vaults" and that "projects" are actually folders too. "Projects" in ProjectWise are referred to as "rich projects" in the documentation.
PS - I forgot to mention that you really, really shouldn't attempt to modify anything directly in the database. Always use the APIs. The only exception would be, and is commonly done and is OK, is to update rows in your environment tables for only the user attribute columns. This is one of the reasons why there is the "Create attribute records upon document creation" option for environments. It allows you to "snyc" some of your user attributes with other systems via SQL based procedures, etc. Don't attempt to create or delete rows from the environment tables without using the APIs!
If the structure marshaling is too difficult, you can manually set the parent folder's environment and then the subfolders you create should inherit that setting.
I haven't checked recently, but I believe that environments are only "inherited" (made the same as the parent) if you use one of the Dialog based function calls.
Environments are not inherited.
I have the project and document creation working, and I see that I could use the modify project funktion, but my programming knowledge does not extend to the usage of hooks.
aaApi_ModifyProject2 ( LPAADMSPROJITEM lpProject
Do you have some examples that could help me
The CreateProject2 is using hooks too so that why I used CreateProject
Is it so
Nobody can help me out here ?
Have nobody tried this in VBA ?
Any help is aprieciated
I can't help you with the VBA part, but you don't need to use a hook. The LPAADMSPROJITEM is a structure, actually, what you really are accessing is a pointer to a structure, so you need a way to access what is being referenced by that pointer. And unfortunately for you, two of the items in the structure are also pointers, so you will need to deal with that as well.
You could see if you can find some sample code via Google, etc. on how to access pointers to structures from VBA. I suspect that there are plenty of Win32 code snippets that would require this, but I'm assuming that you can do it from VBA.
Another option would be to try your hand at some C/C++. It may not be as "hard" as you think. You could write a "wrapper" function that you could then call from VBA.
I'll give it a try.
morested, you could try copying a template folder that is setup the way you want with aaApi_CopyProject. If I were to call it from C# I would declare it like this:
external static bool aaApi_CopyProject ( int lSourceProjectId,
IntPtr fpCallBack, //set to null (IntPtr.Zero)
IntPtr aaUserParam, //set to null (IntPtr.Zero)
ref int lplCount
I am not sure how this translates to VB.NET but you don't have to marshal any structures.