I can't get attachments to download through the API. I've tried adding "remote://" for both the "cwd" and "outputFile" options but nothing seems to point the command to my local computer. Any idea what I'm missing? Here is my code
private string localFolder = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
public void SaveAttachments(int IssueId, string FieldName, List<MKS.ManagedAPI.Item> AttachmentItems)
{
try
{
Command cmd = new Command("im", "extractattachments");
cmd.AddOption("hostname", hostServer);
cmd.AddOption("port", hostPort.ToString());
cmd.AddOption("user", userName);
cmd.AddOption("password", userPassword);
cmd.AddOption("cwd", Path.Combine("remote://", localFolder, IssueId.ToString()));
cmd.AddOption("outputFile", Path.Combine("remote://", localFolder, IssueId.ToString(), AttachmentItems[0].Id.ToString()));
cmd.AddOption("field", FieldName);
cmd.AddOption("issue", IssueId.ToString());
if (!APIFactory.IsInitialized)
APIFactory.MKSInitialize();
IIntegrationPoint ip = APIFactory.CreateIntegrationPoint(hostServer, hostPort, false, 4, 13);
ISession s = ip.CreateSession(userName, userPassword);
ICmdRunner cr = s.CreateCmdRunner();
IResponse r = cr.Execute(cmd);
cr.Dispose();
s.Dispose();
ip.Dispose();
}
catch (Exception ex)
{
ExceptionUtilities.LogException(ex, ex.Message);
}
finally
{
// Nothing.
}
}
The error I get is:
im: MKS124822: Invalid value provided for "outputFile": File paths must be rooted in /opt/plm/IntegrityServer10/data/tmp: outputFile is set to /opt/plm/IntegrityServer10/bin/C:\Users\userName\Documents\Visual Studio 2013\Projects\GATestExecutionClient\GATestExecutionClient\bin\x86\Debug\AppX/C:\Users\userName\AppData\Local\Packages\f6931c13-f27d-4e60-849e-9aabd681f391_4vvq3fpr0tnrp\LocalState\24682\icon_home_news_bug.png