It's all about the answers!

Ask a question

RTC SDK: Giving names to the files uploaded

Rafael Hayama (15926) | asked Jan 21 '13, 8:03 a.m.
When uploading files into a repository using RTC Eclipse IDE it does not retain the original file name and asks the user to name it.

One customer created a RTC Eclipse plugin that uploads more than one file to a Work Item and noticed this same behaviour. He wants to know if there's any API that could be used in order to upload the file and keep its name.

2 answers

permanent link
Ralph Schoon (58.0k23642) | answered Jan 21 '13, 8:54 a.m.
Hi, this post describes the upload process. . As far as I recall the name can be set. If I upload a file to a work item, the file name is typically kept.

permanent link
SEC Servizi (94622547) | answered Jan 21 '13, 8:40 a.m.
edited Jan 21 '13, 8:45 a.m.
If this can helps you, we programmatically add new contributions to Build Results as:
File file = new File(path);
ITeamRepository repo = ...
IContent content = repo.contentManager().storeContent(IContent.CONTENT_TYPE_UNKNOWN, null, LineDelimiter.LINE_DELIMITER_NONE, inputStream, null, null);InputStream inputStream = new FileInputStream(file); IBuildResultContribution contribution = BuildItemFactory.createBuildResultContribution();  contribution.setComponentName(componentName);
contribution.setExtendedContributionProperty(IBuildResultContribution.PROPERTY_NAME_FILE_NAME, file.getName());
ITeamBuildClient buildClient = (ITeamBuildClient) repo.getClientLibrary(ITeamBuildClient.class); IBuildResult buildResult = ...
buildClient.addBuildResultContribution(buildResult, contribution, null);
As you can see, we use the same filename from the input file:
contribution.setExtendedContributionProperty(IBuildResultContribution.PROPERTY_NAME_FILE_NAME, file.getName());

Your answer

Register or to post your answer.