aaApi_UpdateDocumentRefVersionsaaApi_UpdateDocumentRefVersionsaa() always return false with "Access denied. You have insufficient privileges to finish this operation."

I want to update the version of a reference of a master dgn to a specified version (not the active one) through aaApi_UpdateDocumentRefVersions.

Firstly, I successfully get the AADMS_REFDOCVERSION_FOR_UPDATE struct by aaApi_GetDocumentRefVersionForUpdate. Then pass it as a parameter to aaApi_UpdateDocumentRefVersions. However, the result is always false. By inspecting error info, it says that "Access denied. You have insufficient privileges to finish this operation". The entire operation is done by a super admin account with use access control unchecked.

What's wrong with my code? Or could you provides some example to show how to use this function?

Here's my code snippet:

const auto master_doc_proj_guid = project::GetFolderGuid(master_doc_item.lProjectId);
const auto master_doc_guid = document::GetDocGuid(master_doc_item.lProjectId, master_doc_item.lDocumentId);

ULONG count = 0;
ULONG flags = 0;
AADMS_REFDOCVERSION_FOR_UPDATE * pbuffer;
aaApi_GetDocumentRefVersionsForUpdate(0, 0, &master_doc_guid,&flags, &pbuffer, &count);
if (!aaApi_UpdateDocumentRefVersions(lp_doc_item, &master_doc_guid, pbuffer, count))
{
	const auto error_id = aaApi_GetLastErrorId();
	MessageBoxW(0, aaApi_GetLastErrorMessage(), 0, 0);
	MessageBoxW(0,aaApi_GetLastErrorDetail(),0,0);
	aaApi_RemoveLastError();
}
aaApi_Free(pbuffer);