Set Environment on new Folder using C#

 I need to set the environment on a new folder using C#, but I get an invalid parameter error.

I assume I have defined the _AADMSPROJITEM structure wrong, or confused variables with pointers or similar.

I hoped that Dave Brumbaugh had done this already, but it is not in his PWWrapper.

// define C style _AADMSPROJITEM structure
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
            public struct _AADMSPROJITEM
                public ulong ulFlags; //  This member is the bit mask specifying which of the structure members contains valid information.
                public long lProjectId; // Specifies the project Id.

                public long lEnvironmentId; //Specifies the environment the project belongs to.
                public long lParentId; // Specifies the parent project identifier.
                public long lStorageId; //  Specifies the default storage of the project.
                public long lManagerId; //Specifies the project manager's Id.
                public long lTypeId; //Specifies project's type.
                public long lWorkflowId; //Specifies the workflow identifier assigned to the project.
                public IntPtr lptstrName; //Pointer to a null-terminated string specifying the project name.  LPWSTR
                public IntPtr lptstrDesc; //Pointer to a null-terminated string specifying the project description. LPWSTR
                public long lManagerType; //Specifies the type of project manager.
                public long lWorkspaceProfileId; // Specifies the type of project workspace profile.
                public GUID guidVault; //Specifies the GUID of project.
                public long lComponentClassId; //Specifies the class id of the ODS instance holding rich project properties.
                public long lComponentInstanceId; // Specifies the instance id of the ODS instance holding rich project properties.
                public ulong projFlagMask; // Specifies the valid bits in the member projFlags.
                public ulong projFlags; //  Specifies the project flags to set or reset.

public static Boolean SetProjectEnvironment(int projectID, int environmentenvID)
                _AADMSPROJITEM pProject = new _AADMSPROJITEM();
                pProject.lProjectId = projectID;
                pProject.lEnvironmentId = environmentenvID;;

                return aaApi_ModifyProject2( pProject);

 [DllImport("c:\\Program Files\\Bentley\\ProjectWise\\bin\\dmscli.dll")]
public static extern Boolean aaApi_ModifyProject2(_AADMSPROJITEM lpProject);

Parents Reply Children
No Data