[Building Sakai] Web service file attachment

Kabelo Letsoalo kabelo at opencollab.co.za
Wed Mar 5 07:45:49 PST 2014


Hi

Problem solved.
The version of addAttachmentResource used is deprecated.
addAttachmentResource(String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/String.java#String>
 name, String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/String.java#String>
 site, String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/String.java#String>
 tool, String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/String.java#String>
 type, InputStream<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/io/InputStream.java#InputStream>
 content, ResourceProperties<http://grepcode.com/file/repo1.maven.org/maven2/org.sakaiproject.kernel/sakai-kernel-api/1.3.1/org/sakaiproject/entity/api/ResourceProperties.java#ResourceProperties>
 properties) fixed it.

Thanks


On 5 March 2014 16:57, Kabelo Letsoalo <kabelo at opencollab.co.za> wrote:

> Hi all
>
> Submitting an assignment with attachment via web service.
> When doing this via the web UI the url for the attachment ends with
> siteId/Assignments/randomString/file.txt
>
> When using web service the attachment url does not have the
> siteId/Assignments prefix. Url only contains randomString/file.txt
>
> How I add Attachment:
>
> ResourcePropertiesEdit resourcePropertiesEdit =
> contentHostingService.newResourceProperties();
> resourcePropertiesEdit.addProperty(resourcePropertiesEdit.PROP_DISPLAY_NAME,
> attachmentName);
> ContentResource file =
> contentHostingService.addAttachmentResource(attachmentName,
> attachmentMimeType, content, resourcePropertiesEdit);
> Reference ref = entityManager.newReference(file.getReference());
> assignmentSubmissionEdit.addSubmittedAttachment(ref);
>
> What's the fix for this?
>
> Appreciate any the help. Thanks.
>



-- 
Kabelo Letsoalo
Junior Developer
opencollab
Tel: +27 21 970 4000 | Fax: +27 21 914 3098
Web: www.opencollab.co.za

-- 

------------------------------
See OpenCollab email disclaimer at 
http://www.opencollab.co.za/email-disclaimer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140305/358417bb/attachment.html 


More information about the sakai-dev mailing list