AnsweredAssumed Answered

How to access course message Attachments by API

Question asked by mk0046175 on Mar 7, 2018
Latest reply on Mar 15, 2018 by Alberto Ruiz

I am trying to access the messages through blackboard API. I am using the BB version 3300.0.1

Initially i tried to access the messages through public rest API(https://developer.blackboard.com/portal/displayApi), but unable to access it.

I have the course id and user id through which i get the course message details.

 

 

This is the entire black of code to access the message through API

//bbCourseId -- >blackboard course id

//blackboard.data.course.Course;

Course course = CourseDbLoader.Default.getInstance().loadById(bbCourseId);

 

 

//blackboard.data.user.User;

//emplId - -> blackboard employee id

User fromUser = getBlackboardUser(emplId);

 

 

//get list of messages for the user/course

//blackboard.data.message.Message

MessageBox box = MessageBox.initMessageBox(fromUser, course);

List<Message> messageList = box.getFolder(folderName.trim()).getMessageList();

 

 

//load attachment of each message

//if(courseMessage.hasAttachment)

//blackboard.data.message.MessageAttachment;

MessageAttachment messageAttachment=MessageAttachment.loadAttachment(courseMessage);

 

 

//I am able to get the attachment file name

courseMessage.getAttachment().getAttachmentFileName()

 

 

//I am unable to get the actual attachment

BbFile bbFile=messageAttachment.getAttachedFile();

 

Exception stacktrace is attached. Your help is appreciated.

Outcomes