repo.login(monitor);
IWorkItemClient workItemClient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager copyManager = workItemClient.getWorkItemWorkingCopyManager();
IWorkItemHandle workItemHandle = workItemClient.findWorkItemById(
workItemNumber, IWorkItem.FULL_PROFILE, monitor);
copyManager.connect(workItemHandle, IWorkItem.FULL_PROFILE, monitor);
WorkItemWorkingCopy workItemCopy = copyManager.getWorkingCopy(workItemHandle);
// IWorkItem workItem = workItemCopy.getWorkItem();
IWorkItemReferences references = workItemCopy.getReferences();
IContentManager contentManager = repo.contentManager();
List
for (IReference reference : attachments) {
IItemReference attachmentReference = (IItemReference) reference;
IAttachmentHandle attachmentHandle = (IAttachmentHandle) attachmentReference.resolve();
IAttachment attachment = (IAttachment) repo.itemManager().fetchCompleteItem(attachmentHandle,
IItemManager.DEFAULT, monitor);
FileOutputStream fileStream;
try {
fileStream = new FileOutputStream("C:\\temp\\" + attachment.getName());
contentManager.retrieveContent(attachment.getContent(), fileStream, null);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
TeamPlatform.shutdown();
댓글 없음:
댓글 쓰기