ProjectWise API accepts incorrect values for Document Code

Hi

Someone who can help me, would be greatly appreciated. Will try to explain in my poor English

Has developed a function for sending files with metadata (attribute values) from a document system to a ProjectWise data source. The ProjectWise data sources usually have unique document codes set in the environment as requirements.

My function can handle all parts of the code and retrieve approved values from Fixed List and SQL Statements, so the function knows which values are selectable, but I had hoped that the ProjectWise API would give me that feedback when attribute values are set.

After uploading a file to ProjectWise, all attribute values, required attributes and document codes are set first to verify a successful upload, then other mapped attribute values are set.

This is my approach
Code snippet, using C#

aaApi_FreeLinkDataInsertDesc()
aaApi_GetEnvTableInfoByProject(iprojID, ref lEnvId, ref lTabId, ref lColumnId)
int lColCount = aaApi_SelectColumnsByTable(lTabId)

//Here is my problem: The function returns true to bOkSetLinkData even if newAttributeValue is not one of the approved values according to the attribute settings
bool bOkSetLinkData = aaApi_SetLinkDataColumnValue(lTabId, lColumnId2, newAttributeValue)

Later…

_AADOC_ITEM docitem = new _AADOC_ITEM()
{
     lProjectId = iprojID,
     lDocumentId = docId
};

 _AAEALINKAGE linkage = new _AAEALINKAGE()
{
    documentId = docitem,
    lEnvironmentId = lEnvId,
    lLinkageType = (int)AttributeLinkageTypes.AADMS_EALNK_DOCUMENT
};

int lplAttrRecId = 0;
bool bok = CreateEnvironmentAttributes(lTabId, linkage, ref lplAttrRecId);

public static bool CreateEnvironmentAttributes(int lTableId, _AAEALINKAGE lpLinkage, ref int lplAttrRecId)
{
    IntPtr messagePtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(lpLinkage));
    Marshal.StructureToPtr(lpLinkage, messagePtr, false);
    return aaApi_CreateEnvAttr(lTableId, messagePtr, ref lplAttrRecId);
}

In other words, this can end up with me getting a file uploaded with an unapproved document code, the API has overridden the rules that apply when doing this manually from ProjectWise Explorer.

Could this be due to an incomplete configuration in ProjectWise Administrator of the data source or is the ProjectWise API designed so that it does not check approved values but only that all requirements are met?

Should document codes be handled with other code functionality?

Thanks in advance!

 /Per Bodin - Adtollo AB