在使用ProjectWise SDK提取文档时,我遇到了以下问题。任何解决方案或指针都将真正有用。
Bentley ProjectWise版本:10(10.00.07.30)
问题:
我正在使用aaApi_FetchDocumentFromServer
方法调用从给定项目中获取文档。调用失败,并返回错误代码50050(AAERR_MISSING_DOC_IDENTIFIERS
)。以下是我收到的错误描述:
必须标识文件夹和文档号才能执行此操作。错误代码:50050“
这是我基于很少的论坛回复/文档用C#编写的代码:
/* Key DllImport calls */
/* Key DllImport calls */
/* PwDotnet.cs */
[DllImport("DMSCLI.DLL", CharSet = CharSet.Unicode)]
public static extern bool aaApi_FetchDocumentFromServer(uint ulFags, long lProjectId, long lDocumentId, string lpctstrWorkdir, StringBuilder lptstrFileName, int lBufferSize);
[DllImport("DMSCLI.DLL", CharSet = CharSet.Unicode)]
public static extern long aaApi_GetProjectIdByNamePath(string projectPath);
/*PWAdapter.cs */
long projectId = PwDotNet.aaApi_GetProjectIdByNamePath("MyTestProject");/* Gives me the project id number e.g 1732 . Confirmed by calling aaApi_GetProjectNamePath2 to get the project name back*/
/* Code to fetch document id */
var documentId = 72; // Got this id by making separate call to PwDotNet.aaApi_GetDocumentId();
var documentName = "test.msg" // obtained the documentName aaApi_SelectDocument and aaApi_GetDocumentStringProperty calls
StringBuilder sbFileName = new StringBuilder(1024,1024); // I even tried 256 and other numbers suggested in other forum questions, but no success as the error code is 50050
sbFileName.Append(documentName);
bool isDownloadSuccessful = PwDotNet.**aaApi_FetchDocumentFromServer**((int)PwDotNet.DocumentFetchFlags.AADMS_DOCFETCH_COPYOUT, projectId, documentId, @"C:\\Test", sbFileName, sbFileName.MaxCapacity);
if (!isDownloadSuccessful)
{
var error = this.GetLastErrorDetails();
}
我检索的项目ID和文档ID似乎有效,因为我能够检索项目/文档的名称。但是,调用获取文档失败,并显示错误。任何指针将非常有帮助。谢谢。